Ejemplo n.º 1
0
        public async Task <IActionResult> Update(long id, [FromBody] UpdateIdeaRequestViewModel updateIdeaViewModel)
        {
            if (ModelState.IsValid)
            {
                Idea item = IdeaModelMapper.BuildIdeaModel(updateIdeaViewModel);

                await _ideaService.Update(item);

                return(new NoContentResult());
            }

            return(Error(ModelState));
        }
Ejemplo n.º 2
0
 public static Idea BuildIdeaModel(UpdateIdeaRequestViewModel viewModel)
 {
     return(new Idea
     {
         Id = viewModel.Id,
         Name = viewModel.Name,
         Description = viewModel.Description,
         GranteeId = viewModel.GranteeId,
         ImageUrl = viewModel.ImageUrl,
         OccasionId = viewModel.OccasionId,
         WhereToBuy = viewModel.WhereToBuy
     });
 }