Beispiel #1
0
        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));
        }
Beispiel #2
0
        public ActionResult Create(VehicleHistoryItem model)
        {
            VehicleHistoryService objVH = new VehicleHistoryService();

            objVH.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Beispiel #3
0
        public int Update(VehicleHistoryItem model)
        {
            Mapper.CreateMap <VehicleHistoryItem, Vehicle_History>();
            Vehicle_History objVH = DbContext.Vehicle_History.SingleOrDefault(m => m.ID == model.ID);

            objVH = Mapper.Map(model, objVH);
            return(DbContext.SaveChanges());
        }
Beispiel #4
0
        public VehicleHistoryItem GetById(int id)
        {
            Mapper.CreateMap <Vehicle_History, VehicleHistoryItem>();
            Vehicle_History    objVhtbl  = DbContext.Vehicle_History.SingleOrDefault(m => m.ID == id);
            VehicleHistoryItem objVHItem = Mapper.Map <VehicleHistoryItem>(objVhtbl);

            return(objVHItem);
        }
Beispiel #5
0
        public ActionResult Edit(VehicleHistoryItem model)
        {
            VehicleHistoryService objVH = new VehicleHistoryService();

            model.UpdatedOn = System.DateTime.Now;
            objVH.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Beispiel #6
0
 public int Insert(VehicleHistoryItem model)
 {
     try
     {
         Mapper.CreateMap <VehicleHistoryItem, Vehicle_History>();
         Vehicle_History objVehicle = Mapper.Map <Vehicle_History>(model);
         DbContext.Vehicle_History.Add(objVehicle);
         return(DbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #7
0
 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"] }));
 }