Exemplo n.º 1
0
        public async Task <IActionResult> DeleteWatchmanProfile()
        {
            var userStringId     = User.FindFirstValue("userIdClaim");
            var watchmanStringId = User.FindFirstValue("watchmanIdClaim");

            if (String.IsNullOrWhiteSpace(userStringId) ||
                !Guid.TryParse(userStringId, out var userId) ||
                !Guid.TryParse(watchmanStringId, out var watchmanId))
            {
                return(RedirectToAction("RefreshToken", "Account", new { returnUrl = Request.Path.Value }));
            }
            else
            {
                await _userHealthService.RemoveWatchmanFromUser(userId, this.GetAccessTokenFromCookies());

                await _watchmanPatientService.DeleteWatchmanProfile(watchmanId, this.GetAccessTokenFromCookies());

                return(RedirectToAction("RefreshToken", "Account", new { returnUrl = @"\Account\Account" }));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteWatchman([FromBody] GuidFieldViewModel model)
        {
            await _userHealthService.RemoveWatchmanFromUser(model.Id);

            return(Ok());
        }