| Vehicle Type Code | Vehicle Type Name | ||
|---|---|---|---|
|
Update
|
@item["V_T_CODE"] | @item["V_T_NAME"] |
Delete
|
Failed to load resource: the server responded with a status
@model MMs_Admin.M_VehicleType
@{
ViewBag.Title = "VehicleType";
Layout = "~/Views/Shared/_AdminLayOut1.cshtml";
}
@section css{
@**@
}
@section script{
}
this is my controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MMs_Admin.Models;
using System.Data;
using System.ComponentModel;
using Newtonsoft.Json;
namespace MMs_Admin.Controllers
{
public class VehicleController : Controller
{
Material_MS_PSDEntities MsEntity = new Material_MS_PSDEntities();
[HttpGet]
public ActionResult VehicleType()
{
Db Db = new Db();
List ds = Db.ShowAllVehicle();
ViewBag.VType = ds;
return View();
}
[HttpPost]
public JsonResult SaveDataInDatabase(M_VehicleType model)
{
var result = false;
try
{
if (model.V_T_CODE > 0)
{
M_VehicleType Stu = MsEntity.M_VehicleType.SingleOrDefault(x => x.V_T_CODE == model.V_T_CODE);
Stu.V_T_NAME = model.V_T_NAME;
MsEntity.SaveChanges();
result = true;
}
else
{
Db Db = new Db();
M_VehicleType Stu = new M_VehicleType();
Stu.V_T_NAME = model.V_T_NAME;
Db.Insert_VahicleType(Stu);
result = true;
}
}
catch (Exception ex)
{
throw ex;
}
return Json(result, JsonRequestBehavior.AllowGet);
}
}
}
it is not going to the json action in controller
Replies
Know the answer? Post it — somebody with the same question will find it here.