public ActionResult <WishList> Edit([FromBody] WishList update, int id)
 {
     try
     {
         update.Id = id;
         return(Ok(_service.Edit(update)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public async Task <ActionResult <WishList> > Edit([FromBody] WishList update, int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                update.CreatorId = userInfo.Id;
                update.Id        = id;
                return(Ok(_service.Edit(update)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <WishList> > Edit([FromBody] WishList updated, int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                //NOTE attach creatorId so you can validate they are the creator of the original
                updated.CreatorId = userInfo.Id;
                updated.Creator   = userInfo;
                updated.Id        = id;
                return(Ok(_service.Edit(updated)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }