示例#1
0
        public ActionResult Edit(int id)
        {
            objTenancyService = new TenancyService();
            objTenancyItem    = new TenancyItem();

            // string strid = objTenancyService.Decrypt(id.ToString());
            //string strid = id.ToString();
            //int Tid = Convert.ToInt32(strid);

            objTenancyItem = objTenancyService.GetByid(id);

            //CompanyBind
            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany = objTenancyService.GetCompany();
            objTenancyItem.ListCompany = new List <CompanyItem>();
            objTenancyItem.ListCompany.AddRange(lstCompany);

            //Employee Bind
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();

            lstEmp = objTenancyService.GetEmployee();
            objTenancyItem.ListEmployee = new List <EmployeeItem>();
            objTenancyItem.ListEmployee.AddRange(lstEmp);

            // ListGrid bind

            List <TenancyItem> ListTenancy = new List <TenancyItem>();

            ListTenancy = objTenancyService.getTenancyDoc(id);
            objTenancyItem.ListTenancy = new List <TenancyItem>();
            objTenancyItem.ListTenancy.AddRange(ListTenancy);

            //TenancyType
            List <clsMasterData> lstTT = new List <clsMasterData>();

            lstTT = objTenancyService.GetTenancyType();
            objTenancyItem.ListTT = new List <clsMasterData>();
            objTenancyItem.ListTT.AddRange(lstTT);

            //ViewBag.Menuid = objTenancyService.Decrypt(Request.QueryString["menuid"]);
            ViewBag.Menuid = (Request.QueryString["menuid"]);

            return(View(objTenancyItem));
        }
示例#2
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         TenancyService objTenService = new TenancyService();
         TenancyItem    objDoc        = new TenancyItem();
         objDoc = objTenService.GetByid(id);
         db.TenancyMasters.Remove(db.TenancyMasters.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. ";
         //ViewBag.Action = "Create";
         //ViewBag.Controller = "TenancyController";
         //ViewBag.view = "Tenancy" + id + menuid;
         return(View("Error"));
     }
     return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] }));
 }