Exemplo n.º 1
0
        public ActionResult <string> Put([FromBody] Keep value)
        {
            int result = _keepRepo.EditKeep(value);

            if (result == 1)
            {
                return(Ok("Keep"));
            }
            return(BadRequest("FAIL"));
        }
Exemplo n.º 2
0
        public ActionResult <Keep> Put([FromBody] Keep newKeep)
        {
            Keep result = _kr.EditKeep(newKeep);

            if (result != null)
            {
                return(result);
            }
            return(BadRequest("Could not edit keep"));
        }
Exemplo n.º 3
0
        public ActionResult <Keep> Edit(int id, [FromBody] Keep editedKeep)
        {
            editedKeep.UserId = HttpContext.User.Identity.Name;
            Keep updatedKeep = _pr.EditKeep(editedKeep);

            if (updatedKeep == null)
            {
                return(BadRequest("Failed to edit keep"));
            }
            return(Ok(updatedKeep));
        }
Exemplo n.º 4
0
 public ActionResult <string> Put(int keepId, [FromBody] Keep keep)
 {
     try
     {
         _repo.EditKeep(keep);
         return(Ok("Keep Updated"));
     }
     catch (Exception e)
     {
         return(BadRequest("Cannot edit keep"));
     }
 }
Exemplo n.º 5
0
        public ActionResult <Keep> EditKeep([FromBody] Keep keep)
        {
            //dangerous; we should use the repo(?) to also verify that the keep being editted is actually the user's keep?  from here they could "steal" a keep, but not give it to someone else

            var id   = HttpContext.User.FindFirstValue("Id");
            var user = _userRepo.GetUserById(id);

            if (user != null && keep.userId == id)
            {
                return(Ok(_keepRepo.EditKeep(keep)));
            }
            return(BadRequest());
        }
Exemplo n.º 6
0
 public Keep Put(int id, [FromBody] Keep keep)
 {
     return(_repo.EditKeep(id, keep));
 }