public ActionResult Edit(int id) { VehicleHistoryService objVHService = new VehicleHistoryService(); VehicleHistoryItem objVHItem = new VehicleHistoryItem(); objVHItem = objVHService.GetById(id); List <VehicleHistoryItem> lstPExp = new List <VehicleHistoryItem>(); objVHItem.ListVH = new List <VehicleHistoryItem>(); objVHItem.ListVH.AddRange(lstPExp); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } #region Bind DropDown Vehicle List <VehicleItem> lstVehicle = new List <VehicleItem>(); lstVehicle = objVHService.GetVehicle(cid); objVHItem.ListVehicle = new List <VehicleItem>(); objVHItem.ListVehicle.AddRange(lstVehicle); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objVHService.GetEmp(cid); objVHItem.ListEmp = new List <EmployeeItem>(); objVHItem.ListEmp.AddRange(lstEmp); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objVHItem)); }
public ActionResult Create(VehicleHistoryItem model) { VehicleHistoryService objVH = new VehicleHistoryService(); objVH.Insert(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public ActionResult Edit(VehicleHistoryItem model) { VehicleHistoryService objVH = new VehicleHistoryService(); model.UpdatedOn = System.DateTime.Now; objVH.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
// GET: VehicleHistory public ActionResult Index(IEnumerable <VehicleHistoryListItem> model) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new VehicleHistoryService(userId); model = service.GetVehicleHistories(); return(View(model)); }
public ActionResult Create(VehicleHistoryCreate model) { if (!ModelState.IsValid) { return(View(model)); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new VehicleHistoryService(userId); service.CreateVehicleHistory(model); return(RedirectToAction("Index")); }
public ActionResult delete(int id, int menuid) { try { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); VehicleHistoryService objService = new VehicleHistoryService(); VehicleHistoryItem objDoc = new VehicleHistoryItem(); objDoc = objService.GetById(id); db.Vehicle_History.Remove(db.Vehicle_History.Find(id)); db.SaveChanges(); //ViewBag.Empid = Empid; ViewBag.Menuid = Request.QueryString["menuId"]; } catch (Exception ex) { //ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. "; return(View("Error")); } return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] })); }