예제 #1
0
        public async Task <IActionResult> DeleteFavourite(int memeId)
        {
            string userId = User.Claims.First(c => c.Type == "UserID").Value;
            await _service.DeleteFavourite(memeId, userId);

            return(NoContent());
        }
예제 #2
0
 public IActionResult Delete(string id, string title)
 {
     try
     {
         return(Ok(service.DeleteFavourite(id, title)));
     }
     catch (FavouriteNotFoundException ex)
     {
         return(Conflict(ex.Message));
     }
 }
예제 #3
0
 public IActionResult Delete(string userId)
 {
     try
     {
         return(Ok(_service.DeleteFavourite(userId)));
     }
     catch (FavouriteNotFound ex)
     {
         return(Conflict(ex.Message));
     }
 }
예제 #4
0
 public IActionResult Delete(int id)
 {
     try
     {
         return(Ok(service.DeleteFavourite(id)));
     }
     catch (PlayerNotFoundException p)
     {
         return(NotFound(JsonConvert.SerializeObject(p.Message)));
     }
 }
 public ActionResult Delete(int playerId, string userId)
 {
     try
     {
         var deleteStatus = favouriteService.DeleteFavourite(playerId, userId);
         return(Ok(deleteStatus));
     }
     catch (FavouritePlayerNotFoundException favException)
     {
         return(NotFound(favException.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
예제 #6
0
        public IActionResult Delete([FromBody] FavouriteDto favouriteDto)
        {
            try
            {
                ClaimsIdentity identity = HttpContext.User.Identity as ClaimsIdentity;
                int            userId   = int.Parse(identity.FindFirst(ClaimTypes.NameIdentifier).Value);

                _service.DeleteFavourite(userId, favouriteDto.PostId);

                return(Ok());
            }
            catch (FavouriteNotFoundException)
            {
                return(NoContent());
            }
            catch (PostNotFoundException)
            {
                return(NotFound());
            }
        }