public ActionResult WardEntry(string id)
 {
     ViewBag.prabhag = new SelectList(_prabhag.GetAll(), "pkid", "Prabhag_Name");
     if (!String.IsNullOrWhiteSpace(id))
     {
         int               _id   = Convert.ToInt32(id);
         tbl_Ward_master   model = _ward.Get(_id);
         tbl_Ward_masterss abc   = new tbl_Ward_masterss();
         abc.pkid         = model.pkid;
         abc.prabhag_fkid = model.prabhag_fkid;
         abc.ward_Name    = model.ward_Name;
         abc.description  = model.description;
         abc.address      = model.address;
         abc.adddate      = DateTime.Now;
         return(View(abc));
     }
     return(View());
 }
 public ActionResult WardEntry(tbl_Ward_masterss model)
 {
     ViewBag.prabhag = new SelectList(_prabhag.GetAll(), "pkid", "Prabhag_Name");
     try
     {
         if (model.pkid == 0)
         {
             tbl_Ward_master abc = new tbl_Ward_master();
             abc.prabhag_fkid = model.prabhag_fkid;
             abc.ward_Name    = model.ward_Name;
             abc.description  = model.description;
             abc.address      = model.address;
             abc.adddate      = DateTime.Now;
             _ward.Add(abc);
         }
         else
         {
             int             _id = Convert.ToInt32(model.pkid);
             tbl_Ward_master abc = _ward.Get(_id);
             abc.pkid         = model.pkid;
             abc.prabhag_fkid = model.prabhag_fkid;
             abc.ward_Name    = model.ward_Name;
             abc.description  = model.description;
             abc.address      = model.address;
             abc.adddate      = DateTime.Now;
             _ward.Update(abc);
         }
         return(RedirectToAction("WardEntry", "SystemMaster"));
     }
     catch (Exception e)
     {
         Commonfunction.LogError(e, Server.MapPath("~/Log.txt"));
         ViewBag.Exception = e.Message;
         return(View());
     }
 }