public ActionResult Create(AppointmentsPageModel pageModel) { bool?succeeded = null; var newModel = pageModel.NewAppoitmentModel; var userData = Session["UserData"] as UserData; ModelState.Clear(); if (ModelState.IsValid) { succeeded = _appointmentsRepository.Create(newModel, userData); } else { return(new BsJsonResult( new Dictionary <string, object> { { "Errors", ModelState.GetErrors() } }, BsResponseStatus.ValidationError)); } return(Redirect(Url.Action("Index", "Appointments"))); }
public ActionResult Index() { var userData = Session["UserData"] as UserData; var options = new Dictionary <string, object> { { "getEvents", Url.Action("GetEvents") }, { "currentCulture", Thread.CurrentThread.CurrentCulture.Name.Split('-')[0] }, }; RequireJsOptions.Add("Index", options); var model = new AppointmentsPageModel { AppointmentsListModel = new AppointmentsListModel(), NewAppoitmentModel = _appointmentsRepository.GetNewAppoitmentModel() }; return(View(model)); }