Esempio n. 1
0
        public ActionResult <Keep> Get(int id)
        {
            Keep found = _kr.FindById(id);

            if (found == null)
            {
                return(BadRequest("No keep at that ID"));
            }
            return(Ok(found));
        }
Esempio n. 2
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");
        }