Esempio n. 1
0
        public async Task <IActionResult> PutAsync(int id, ReceitaModel receita)
        {
            try
            {
                var mapper = _mapper.Map <Model.Receita>(receita);
                mapper.Id = id;
                var total = await _service.UpdateAsync(mapper);

                if (total > 0)
                {
                    return(new OkObjectResult(mapper));
                }

                return(new NotFoundResult());
            }
            catch (Exception ex)
            {
                return(new BadRequestObjectResult(ex));
            }
        }