public ActionResult ConsultantRegister() { List <ConsultantRegister> CategoryList = new List <ConsultantRegister>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchConsultantRegister"; ds = dl.FetchInPatientConsultant_sp(p); List <SelectListItem> Categoryinventory = new List <SelectListItem>(); Categoryinventory.Add(new SelectListItem { Text = "Select", Value = "" }); foreach (DataRow dr in ds.Tables[1].Rows) { Categoryinventory.Add(new SelectListItem { Text = dr["FullName"].ToString(), Value = dr["EmployeeId"].ToString() }); } ViewBag.Categoryinventory = new SelectList(Categoryinventory, "Value", "Text"); try { foreach (DataRow item in ds.Tables[0].Rows) { ConsultantRegister m = new ConsultantRegister(); m.CId = item["CId"].ToString(); m.UserId = item["UserId"].ToString(); m.AppDate = item["AppDate"].ToString(); m.EmployeeId = item["EmployeeId"].ToString(); m.FullName = item["FullName"].ToString(); m.Instruction = item["Instruction"].ToString(); m.InstructionDate = item["InstructionDate"].ToString(); m.AddedBy = item["AddedBy"].ToString(); //m.IsActive = item["IsActive"].ToString(); CategoryList.Add(m); } ViewBag.CategoryList = CategoryList; } catch (Exception e) { } return(View()); }
public ActionResult ConsultantRegister(ConsultantRegister c) { HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"]; string AddedBy = rxgoAdminCookie.Values["Hid"]; c.AddedBy = AddedBy; try { if (dl.InsertInPatientConsultant_Sp(c) > 0) { TempData["MSG"] = "Consultant Register Added Successfully"; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Redirect("/InPatient/ConsultantRegister")); } TempData["MSG"] = "Consultant Register Added Successfully."; return(Redirect("/InPatient/ConsultantRegister")); }