Exemplo n.º 1
0
        public IActionResult Update(string id, [FromBody] Dto.UpdateTODOItem todoItemDto)
        {
            var todoItem = TODORepo.GetById(id);

            Mapper.Map(todoItemDto, todoItem);
            TODORepo.Update(todoItem);
            return(Ok());
        }
Exemplo n.º 2
0
        public IActionResult Create(string id, [FromBody] Dto.UpdateTODOItem newTodoItemDto)
        {
            var newTODOItem = new Model.TODOItemModel(id);

            Mapper.Map(newTodoItemDto, newTODOItem);
            TODORepo.Create(newTODOItem);

            var createdTODOItem = TODORepo.GetById(newTODOItem.Id);

            Logger.LogInformation("New product was created: {@TODOItemModel}", createdTODOItem);

            return(Created($"{id}", Mapper.Map <Dto.TODOItemModel>(createdTODOItem)));
        }