public ActionResult Unit() { List <RadiologyUnit> CategoryList = new List <RadiologyUnit>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchUnit"; ds = dl.FetchRadiologyUnit_sp(p); try { foreach (DataRow item in ds.Tables[0].Rows) { RadiologyUnit m = new RadiologyUnit(); 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(RadiologyUnit c) { HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"]; string AddedBy = rxgoAdminCookie.Values["Hid"]; c.AddedBy = AddedBy; try { if (dl.InsertRadiologyUnit_Sp(c) > 0) { TempData["MSG"] = "Data Saved Successfully"; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Redirect("/Radiology/Unit")); } TempData["MSG"] = "Data Saved Successfully."; return(Redirect("/Radiology/Unit")); }