Example #1
0
        public ActionResult Edit(int id)
        {
            PetrolExpService objPExpService = new PetrolExpService();
            PetrolExpItem    objPExpItem    = new PetrolExpItem();

            objPExpItem = objPExpService.GetById(id);
            List <PetrolExpItem> lstPExp = new List <PetrolExpItem>();

            objPExpItem.ListPCard = new List <PetrolExpItem>();
            objPExpItem.ListPCard.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 = objPExpService.GetVehicle(cid);
            objPExpItem.ListVehicle = new List <VehicleItem>();
            objPExpItem.ListVehicle.AddRange(lstVehicle);

            #endregion

            #region Bind DropDown Emp
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();
            lstEmp = objPExpService.GetEmp(cid);
            objPExpItem.ListEmp = new List <EmployeeItem>();
            objPExpItem.ListEmp.AddRange(lstEmp);

            #endregion
            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objPExpItem));
        }
Example #2
0
        public ActionResult Edit(PetrolExpItem model)
        {
            PetrolExpService objPExp = new PetrolExpService();

            objPExp.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Example #3
0
        public ActionResult Create(PetrolExpItem model)
        {
            //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
            //model.EmpID = Empid;
            PetrolExpService objPCard = new PetrolExpService();

            objPCard.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Example #4
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         PetrolExpService objService = new PetrolExpService();
         PetrolExpItem    objDoc     = new PetrolExpItem();
         objDoc = objService.GetById(id);
         db.Petrol_Expense.Remove(db.Petrol_Expense.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"] }));
 }