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

            if (result == 1)
            {
                return(Ok("success"));
            }
            return(BadRequest("Unsuccessful edit"));
        }
Exemplo n.º 2
0
        public ActionResult <Keep> Update(int id, [FromBody] Keep editedKeep)
        {
            Keep updatedKeep = _kr.EditKeep(id, editedKeep);

            if (updatedKeep == null)
            {
                return(BadRequest());
            }
            return(Ok(updatedKeep));
        }
        internal Keep EditKeep(Profile userInfo, Keep editedKeep)
        {
            Keep oldKeep = _repo.GetKeepById(editedKeep.Id);

            if (oldKeep == null)
            {
                throw new Exception("Bad Id");
            }
            if (oldKeep.CreatorId != userInfo.Id)
            {
                throw new Exception("You are not the original poster of the Keep");
            }
            _repo.EditKeep(editedKeep);
            return(_repo.GetKeepById(editedKeep.Id));
        }
Exemplo n.º 4
0
 public string Put(int id, [FromBody] Keeps keep)
 {
     db.EditKeep(keep);
     return("Updated");
 }
Exemplo n.º 5
0
 public void EditKeep([FromBody] Keep aKeep)
 {
     db.EditKeep(aKeep);
 }