Exemplo n.º 1
0
        public IActionResult Patch(string id, [FromBody] RecommendModel recommendModel)
        {
            // map dto to entity and set id
            var user = _iMapper.Map <Recommend>(recommendModel);

            user.RecommendId = id;
            var count = 1;

            try
            {
                // save
                _iRecommendService.Patch(user);
                return(Output(new DeleteOrUpdateResponse
                {
                    id = user.RecommendId,
                }, count));
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }