public ActionResult EditDeviceProblem(DeviceProblemModel model) { using (var con = new SqlConnection(_connectionString)) { if (model.ProblemID == null) { TempData["DeviceProblem"] = "Problem Id Not Found"; } else { var result = con.Query <int>("Add_Edit_Problem" , new { model.CatId, model.SubCatId, model.ProblemID, model.IsActive, model.Problem, model.SortOrder, User = CurrentUser.UserId, CurrentUser.CompanyId, Action = "edit" }, commandType: CommandType.StoredProcedure).FirstOrDefault(); var response = new ResponseModel(); if (result == 2) { response.IsSuccess = true; response.Response = "Successfully Updated"; TempData["response"] = response; } } return(RedirectToAction("ManageDeviceProblems")); } }
public ActionResult ManageDeviceProblems() { DeviceProblemModel dcm = new DeviceProblemModel(); dcm.CatIdList = new SelectList(Enumerable.Empty <SelectListItem>()); if (TempData["DeviceProblem"] != null) { ViewBag.DeviceProblem = TempData["DeviceProblem"].ToString(); } return(View()); }
public ActionResult AddDeviceProblem() { using (var con = new SqlConnection(_connectionString)) { DeviceProblemModel dcm = new DeviceProblemModel(); dcm.CatIdList = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); dcm.SubCatIdList = new SelectList(dropdown.BindSubCategory(dcm.CatId), "Value", "Text"); return(PartialView(dcm)); } }
public ActionResult EditDeviceProblem(int?ProblemID) { DeviceProblemModel dcm = new DeviceProblemModel(); dcm.CatIdList = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); dcm.SubCatIdList = new SelectList(dropdown.BindSubCategory(dcm.CatId), "Value", "Text"); using (var con = new SqlConnection(_connectionString)) { var result = con.Query <DeviceProblemModel>("select * from MstDeviceProblem WHERE ProblemID=@ProblemID", new { ProblemID = ProblemID }, commandType: CommandType.Text).FirstOrDefault(); if (result != null) { result.Category = result.CatId.ToString(); result.SubCategory = result.SubCatId.ToString(); } result.CatIdList = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text"); result.SubCatIdList = new SelectList(dropdown.BindSubCategory(), "Value", "Text"); return(View(result)); } }