public ActionResult EditPurpose(int Id)
        {
            var            VisData = objAdminEnti.tblPurposeMasters.Where(s => s.Id == Id).FirstOrDefault();
            PurposeMasters VisDtls = new PurposeMasters {
                Id = VisData.Id, PurposeName = VisData.PurposeName, PurposeCode = VisData.PurposeCode
            };

            return(View(VisDtls));
        }
 public ActionResult PurposeMaster(PurposeMasters objMaster)
 {
     if (ModelState.IsValid)
     {
         tblPurposeMaster master = new tblPurposeMaster();
         master.PurposeName  = objMaster.PurposeName;
         master.PurposeCode  = objMaster.PurposeCode;
         master.CreatedDate  = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
         master.ModifiedDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
         objAdminEnti.tblPurposeMasters.Add(master);
         objAdminEnti.SaveChanges();
         TempData["Success"] = "Purpose added successfully.";
         return(RedirectToAction("PurposeMaster"));
     }
     return(View());
 }
 public ActionResult EditPurpose(int Id, PurposeMasters objMaster)
 {
     if (ModelState.IsValid)
     {
         var dbPurpose = objAdminEnti.tblPurposeMasters.SingleOrDefault(b => b.Id == Id);
         if (dbPurpose != null)
         {
             dbPurpose.PurposeName  = objMaster.PurposeName;
             dbPurpose.PurposeCode  = objMaster.PurposeCode;
             dbPurpose.ModifiedDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd-MM-yyyy hh:mm"));
             objAdminEnti.tblPurposeMasters.Add(dbPurpose);
             objAdminEnti.tblPurposeMasters.Attach(dbPurpose);
             objAdminEnti.Entry(dbPurpose).State = EntityState.Modified;
             objAdminEnti.SaveChanges();
             TempData["Success"] = "Purpose Updated successfully.";
             return(RedirectToAction("PurposeList"));
         }
     }
     return(RedirectToAction("PurposeList"));
 }
        public ActionResult PurposeMaster()
        {
            PurposeMasters master = new PurposeMasters();

            return(View(master));
        }