Exemple #1
0
        public ActionResult Create(int fromId, MonitoringViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            //Check that the tracking is not closed
            if (_patientService.IsClosed(fromId))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            _monitoringService.Create(viewModel, fromId);

            _monitoringService.Log(OperationType.MonitoringCreate, User.Identity.GetUserId <int>(), fromId);
            return(RedirectToAction("List", new { id = fromId }));
        }
Exemple #2
0
        public void Create()
        {
            //Arrange
            var patientId = _dataContext.Patients.First().Id;
            var viewModel = new MonitoringViewModel
            {
                DateTime    = DateTime.Now,
                Description = "Test123",
                Comments    = "No comments"
            };

            //Act
            _monitoringService.Create(viewModel, patientId);
            var monitoring = _monitoringService.FindByPatientId(patientId).First();

            //Assert
            Assert.That(monitoring, Is.Not.Null);
            Assert.That(monitoring.Description, Is.EqualTo("Test123"));
        }