public async Task <ActionResult <ColetorViewModel> > Post(ColetorViewModel coletorViewModel) { if (!ModelState.IsValid) { return(CustomResponse(ModelState)); } coletorViewModel.Id = await _coletorService.Create(_mapper.Map <Coletor>(coletorViewModel)); return(CustomResponse(coletorViewModel)); }
public async Task <ActionResult <ColetorViewModel> > Put(long id, [FromBody] ColetorViewModel coletorViewModel) { if (id != coletorViewModel.Id) { return(BadRequest()); } if (!ModelState.IsValid) { return(CustomResponse(ModelState)); } await _coletorService.Update(_mapper.Map <Coletor>(coletorViewModel)); return(CustomResponse(coletorViewModel)); }