Exemple #1
0
 public ActionResult <Keep> EditKeep([FromBody] Keep keepToUpdate)
 {
     try
     {
         var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier);
         keepToUpdate.UserId = userId.Value;
         return(Ok(_ks.EditKeep(keepToUpdate)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public async Task <ActionResult <Keep> > EditKeep(int id, [FromBody] Keep editedKeep)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                editedKeep.Id = id;
                return(Ok(_ks.EditKeep(userInfo, editedKeep)));
            }
            catch (System.Exception error)
            {
                return(BadRequest(error.Message));
            }
        }
        public async Task <ActionResult <Keep> > EditKeep(int keepId, [FromBody] Keep editedKeep)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                editedKeep.Creator = userInfo;
                editedKeep.Id      = keepId;

                return(Ok(_service.EditKeep(editedKeep, userInfo.Id)));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.Message));
            }
        }