public ActionResult View(int id) { CredentialService objAppointService = new CredentialService(); CredentialItem objAItem = new CredentialItem(); objAItem = objAppointService.GetById(id); //Session["Empid"] = objPassItem.EmpId; List <CredentialItem> lstAppoint = new List <CredentialItem>(); objAItem.ListCredential = new List <CredentialItem>(); objAItem.ListCredential.AddRange(lstAppoint); ViewBag.Menuid = Request.QueryString["menuId"]; SponsorService objService1 = new SponsorService(); List <CompanyItem> lstCompany = new List <CompanyItem>(); lstCompany = objService1.GetCompany(); objAItem.ListCompany = new List <CompanyItem>(); objAItem.ListCompany.AddRange(lstCompany); VehicleMasterService objVehicle = new VehicleMasterService(); #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objVehicle.GetBranch(); objAItem.ListBranch = new List <BranchItem>(); objAItem.ListBranch.AddRange(lstBranch); #endregion return(View(objAItem)); }
public ActionResult delete(int id, int menuid) { try { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); CredentialService objService = new CredentialService(); CredentialItem objDoc = new CredentialItem(); objDoc = objService.GetById(id); db.CredentialMasters.Remove(db.CredentialMasters.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"] })); }