コード例 #1
0
        public ActionResult EditVisit([ModelBinder(typeof(DevExpressEditorsBinder))] VisitViewModel model)
        {
            Visit visit = visitRepository.GetByKey(model.Id);

            if (visit == null)
            {
                var errorModel = new ErrorViewModel {
                    Caption      = "Visit is not found",
                    ErrorMessage = string.Format("Visit '{0}' is not found in clinical data", model.Caption)
                };
                return(View("ErrorInfo", errorModel));
            }

            visit.Caption           = model.Caption;
            visit.ExpectedVisitDate = model.ExpectedVisitDate;
            visit.VisitDate         = model.VisitDate;
            visit.VisitTime         = model.VisitTime;
            EnsureSqlServer2005Compatibility(visit);
            if (visit.VisitDate.HasValue && visit.VisitTime.HasValue)
            {
                visit.IsCompleted = true;
            }
            visitRepository.Edit(visit);
            visitRepository.Save();

            return(RedirectToAction("ShowVisit",
                                    new {
                patientNumber = visit.Patient.PatientNumber,
                visitName = visit.Caption,
                DXScript = Request["DXScript"]
            }));
        }