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

            recommend.RecommendId = id;
            var count = 1;

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