Example #1
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _kr.Delete(id);

            if (!successful)
            {
                return(BadRequest("No Delete"));
            }
            return(Ok());
        }
Example #2
0
        public bool Delete([FromBody] Keep keep)
        {
            if (HttpContext.User.Identity.Name != keep.UserId)
            {
                throw new Exception("Cannot delete other's keeps!");
            }
            bool deleted = _repo.Delete(keep);

            return(deleted);
        }
Example #3
0
 public ActionResult <String> Delete(int id)
 {
     try
     {
         return(Ok(_repo.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Example #4
0
 public void Delete([FromBody] KeepDiscard keep)
 {
     if (keep.UserId == HttpContext.User.Identity.Name && keep.IsPrivate == 1)
     {
         _repo.Delete(keep.Id);
     }
     else
     {
         throw new Exception("Not authorized to delete public keeps");
     }
 }
Example #5
0
        public ActionResult <string> Delete(int id)
        {
            var  userId     = HttpContext.User.Identity.Name;
            bool successful = _kr.Delete(id, userId);

            if (!successful)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Example #6
0
 public ActionResult <String> Delete(int id)
 {
     try
     {
         var Userid = HttpContext.User.FindFirstValue("Id");
         return(Ok(_repo.Delete(id, Userid)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
 public string Delete(int id)
 {
     try
     {
         var userId = HttpContext.User.FindFirstValue("Id");
         return(_Repo.Delete(id, userId));
     }
     catch (Exception e)
     {
         return($"Error Message{e.Message}");
     }
 }
Example #8
0
        public bool Delete([FromRoute] int id)
        {
            string UserId = HttpContext.User.Identity.Name;

            return(_repo.Delete(id, UserId));
        }