Beispiel #1
0
        public async Task <IActionResult> AddInvestigation(AddInvestigationVM model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("AddInvestigation", new { PatientId = model.PatientId }));
            }
            model.Investigation.PatientId = model.PatientId;
            model.Investigation.Active    = true;
            model.Investigation.Approved  = false;
            _context.Investigations.Add(model.Investigation);
            var details = model.InvestigationDetails;

            details.InvestigationId = model.Investigation.Id;
            _context.InvestigationDetails.Add(details);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Investigations", new { PatientId = model.PatientId }));
        }
Beispiel #2
0
        public IActionResult AddInvestigation(int PatientId)
        {
            var model = new AddInvestigationVM();

            var user = _context.Patient.First(u => u.Id == PatientId);

            model.DOB                  = user.Dob;
            model.PatientId            = PatientId;
            model.PatientName          = user.FirstName + " " + user.LastName;
            model.Investigation        = new Investigations();
            model.InvestigationDetails = new InvestigationDetails();

            // Init datetimes to today for ease of use
            model.Investigation.DateTime           = DateTime.Now;
            model.InvestigationDetails.ExtractTime = DateTime.Now;

            return(View(model));
        }