Ejemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] CreateIdeaRequestViewModel createIdeaViewModel)
        {
            if (ModelState.IsValid)
            {
                Idea item = IdeaModelMapper.BuildIdeaModel(createIdeaViewModel);
                item.Id = await _ideaService.Create(item);

                return(CreatedAtRoute("GetById", new { id = item.Id }, item));
            }

            return(Error(ModelState));
        }
        public async Task <IActionResult> Create(Idea model)
        {
            try
            {
                await _ideaService.Create(model);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }