public ActionResult BatchGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers item) { if (ModelState.IsValid) { try { // Insert here a code to insert the new item in your model item.BatchNumber = new Random().Next(1, 1000000).ToString("D6"); item.CreatedAt = DateTime.Now; item.CreatedBy = User.Identity.GetUserId(); unitOfWork.BatchNumbersRepo.Insert(item); unitOfWork.Save(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } var model = unitOfWork.BatchNumbersRepo.Get(includeProperties: "CreatedByUser"); return(PartialView("_BatchGridViewPartial", model)); }
public ActionResult PatientsGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Patients item, [ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers batchNumbers) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } var model = unitOfWork.PatientsRepo.Get(x => x.BatchId == batchNumbers.Id); ViewBag.batchNumbers = batchNumbers; return(PartialView("_PatientsGridViewPartial", model)); }
public ActionResult PatientsGridViewPartial([ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers batchNumbers) { var model = unitOfWork.PatientsRepo.Get(x => x.BatchNumbers.BatchNumber == batchNumbers.BatchNumber); ViewBag.batchNumbers = batchNumbers; return(PartialView("_PatientsGridViewPartial", model)); }
public JsonResult SearchCasePartial([ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers batchNumbers) { return(Json(new { //PartialView("_SearchPatientGridViewPartial") view = this.RenderViewToString("SearchCasePartial", partial: true) }, JsonRequestBehavior.AllowGet)); }
public ActionResult PatientsGridViewPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] System.Int32 Id, [ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers batchNumbers) { if (Id >= 0) { try { // Insert here a code to delete the item from your model } catch (Exception e) { ViewData["EditError"] = e.Message; } } var model = unitOfWork.PatientsRepo.Get(x => x.BatchId == batchNumbers.Id); ViewBag.batchNumbers = batchNumbers; return(PartialView("_PatientsGridViewPartial", model)); }
public ActionResult BatchGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.BatchNumbers item) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } var model = unitOfWork.BatchNumbersRepo.Get(includeProperties: "CreatedByUser"); return(PartialView("_BatchGridViewPartial", model)); }