示例#1
0
        public async Task <IActionResult> Post(DiagnosisDto dto)
        {
            var userId  = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value;
            var newDiag = await _service.AddAsync(dto, userId);

            return(Ok(newDiag));
        }
        public async Task <IActionResult> Add(DiagnosisFormModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await diagnoses.AddAsync(model.Name, model.Description);

            return(RedirectToAction(
                       nameof(DiagnosesController.Index),
                       "Diagnoses",
                       new { area = string.Empty }));
        }