public BsJsonResult Create(PrescriptionsPageModel pageModel) { var html = string.Empty; bool?succeeded = null; var newModel = pageModel.NewPrescriptionModel; var userData = Session["UserData"] as UserData; if (ModelState.IsValid) { succeeded = _prescriptionsRepository.Create(newModel, userData); } else { return(new BsJsonResult( new Dictionary <string, object> { { "Errors", ModelState.GetErrors() } }, BsResponseStatus.ValidationError)); } return(new BsJsonResult(new { Succeeded = succeeded })); }
public ActionResult Index() { var options = new Dictionary <string, object> { { "drugsBuilderPager", Url.Action("DrugsBuilderPager") }, { "newPrescriptionUrl", Url.Action("Create") } }; RequireJsOptions.Add("Index", options); var userData = Session["UserData"] as UserData; var model = new PrescriptionsPageModel { NewPrescriptionModel = _prescriptionsRepository.GetNewForm(userData) }; return(View(model)); }