Example #1
0
        [HttpPost]//TODO AddPatient
        public async Task <IActionResult> Add([FromBody] WatchmanIdPatientIdViewModel model)
        {
            try
            {
                await _service.AddPatientToWatchmanAsync(model.WatchmanId, model.PatientId);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Example #2
0
        public async Task <IActionResult> AcceptRequest(string requestId)
        {
            if (String.IsNullOrWhiteSpace(requestId) || !Guid.TryParse(requestId, out var result))
            {
                ModelState.AddModelError("", $"Wrong request Id: {requestId}");
            }
            else
            {
                string token = this.GetAccessTokenFromCookies();
                await _controlRequestService.UpdateRequestStatus(result, ControlRequestStatus.Accepted, token);

                var request = await _controlRequestService.GetControlRequest(result, token);

                await _watchmanPatientService.AddPatientToWatchmanAsync(request.WatchmanId, request.PatientId, token);
            }
            return(RedirectToAction("PatientProfile"));
        }