Exemple #1
0
        public IActionResult AddReaction(int PatientId)
        {
            var model = new AddReactionVM();

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

            model.DOB         = user.Dob;
            model.PatientId   = PatientId;
            model.PatientName = user.FirstName + " " + user.LastName;
            model.Reaction    = new Reactions();

            return(View(model));
        }
Exemple #2
0
        public async Task <IActionResult> AddReaction(AddReactionVM model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("AddReaction", new { PatientId = model.PatientId }));
            }
            model.Reaction.PatientId = model.PatientId;
            model.Reaction.Active    = true;
            model.Reaction.Date      = DateTime.Now;
            model.Reaction.Approved  = false;
            _context.Reactions.Add(model.Reaction);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Reactions", new { PatientId = model.PatientId }));
        }