Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteShareAsync(string id)
        {
            var share = await _shareService.GetShareByIdAsync(id);

            var user = await _userService.GetUserFromPrincipalAsync(this.User);

            if (share == null)
            {
                return(NotFound());
            }
            if (share.UserId != user.Id)
            {
                return(Forbid());
            }

            await _shareService.DeleteShareAsync(share);

            return(Ok(new { shareId = id }));
        }