public ActionResult delete(int id, int menuid) { try { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); OtherExpService objTenService = new OtherExpService(); OtherExpItem objDoc = new OtherExpItem(); objDoc = objTenService.GetById(id); db.Other_Expenses.Remove(db.Other_Expenses.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 { @menuId = Request.QueryString["menuId"] })); }
public ActionResult View(int id) { OtherExpService objOExpService = new OtherExpService(); OtherExpItem objOExpItem = new OtherExpItem(); objOExpItem = objOExpService.GetById(id); List <OtherExpItem> lstVehicle = new List <OtherExpItem>(); objOExpItem.ListOExp = new List <OtherExpItem>(); objOExpItem.ListOExp.AddRange(lstVehicle); #region Bind DropDown Comp List <CompanyItem> lstComp = new List <CompanyItem>(); lstComp = objOExpService.GetAllComp(); objOExpItem.ListComp = new List <CompanyItem>(); objOExpItem.ListComp.AddRange(lstComp); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objOExpService.GetEmp(); objOExpItem.ListEmp = new List <EmployeeItem>(); objOExpItem.ListEmp.AddRange(lstEmp); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objOExpService.GetBranch(); objOExpItem.ListBranch = new List <BranchItem>(); objOExpItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Exp List <clsMasterData> lstMasters1 = new List <clsMasterData>(); lstMasters1 = objOExpService.GetExp(); objOExpItem.ListMaster = new List <clsMasterData>(); objOExpItem.ListMaster.AddRange(lstMasters1); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objOExpItem)); }