public ActionResult Unit() { List <PathologyUnit> CategoryList = new List <PathologyUnit>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchUnit"; ds = dl.FetchPathologyUnit_sp(p); try { foreach (DataRow item in ds.Tables[0].Rows) { PathologyUnit m = new PathologyUnit(); m.UnitId = item["UnitId"].ToString(); m.UnitName = item["UnitName"].ToString(); m.AddedBy = item["AddedBy"].ToString(); m.IsActive = item["IsActive"].ToString(); CategoryList.Add(m); } ViewBag.CategoryList = CategoryList; } catch (Exception e) { } return(View()); }
public ActionResult Unit(PathologyUnit c) { HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"]; string AddedBy = rxgoAdminCookie.Values["Hid"]; c.AddedBy = AddedBy; try { if (dl.InsertPathologyUnit_Sp(c) > 0) { TempData["MSG"] = "Data Saved Successfully."; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Redirect("/Pathology/Unit")); } TempData["MSG"] = "Data Saved Successfully."; return(Redirect("/Pathology/Unit")); }