public async Task <ActionResult <TipoDTO> > Post([FromBody] TipoCreateDTO tipoCreate) { var tipo = mapper.Map <Tipo>(tipoCreate); var tipoDTO = mapper.Map <TipoDTO>(await repository.Save(tipo)); return(new CreatedAtRouteResult("ObtenerTipov2", new { id = tipo.Id }, tipoDTO)); }
public async Task<ActionResult<TipoDTO>> Put(int id, [FromBody] TipoCreateDTO tipoCreate) { var tipo = mapper.Map<Tipo>(tipoCreate); var tipoRepo = await repository.Update(id, tipo); if (tipoRepo == null) { return NotFound(); } var tipoDTO = mapper.Map<TipoDTO>(tipoRepo); return new CreatedAtRouteResult("ObtenerTipov1", new { id = tipo.Id }, tipoDTO); }