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

            if (!successful)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Beispiel #2
0
        internal Keep Delete(int id, string userId)
        {
            Keep original = GetById(id);

            if (userId != original.CreatorId)
            {
                throw new Exception("You can only delete your own data");
            }
            _repo.Delete(id);
            return(original);
        }
Beispiel #3
0
        public ActionResult <string> Delete(int id)
        {
            string userId     = HttpContext.User.Identity.Name;
            bool   successful = _kr.Delete(id, userId);

            if (!successful)
            {
                return(BadRequest("Cannot Delete"));
            }
            return(Ok("successfully deleted"));
        }
Beispiel #4
0
        public string Delete(int id)
        {
            string Deleted     = "Keep Deleted";
            bool   deletedKeep = _kr.Delete(id);

            if (deletedKeep)
            {
                return(Deleted);
            }
            ;
            throw new Exception("Not a valid Keep");
        }
Beispiel #5
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));
     }
 }
Beispiel #6
0
        public string Delete(int id, string userId)
        {
            Keep original = _repo.GetOne(id);

            if (original == null)
            {
                throw new System.Exception("Bad Id");
            }
            if (original.CreatorId != userId)
            {
                throw new System.Exception("Not yours. Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("Deleted successfully");
            }
            return("Not Deleted");
        }
Beispiel #7
0
        internal string Delete(int id, string userId)
        {
            Keep data = _repo.FindById(id);

            if (data == null)
            {
                throw new Exception("Bad Id");
            }
            if (data.CreatorId != userId)
            {
                throw new Exception("Not user, Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("deleted succesfully");
            }
            return("did not remove succesfully");
        }
 public string Delete(int id)
 {
     return(_repo.Delete(id));
 }