public async Task <IActionResult> PutClient(int id, InClientDTO inclientDTO) { var client = _mapper.Map <Client>(inclientDTO); if (id != client.Id) { return(BadRequest()); } _context.Entry(client).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Client> > PostClient(InClientDTO inclientDTO) { var client = _mapper.Map <Client>(inclientDTO); _context.Clients.Add(client); await _context.SaveChangesAsync(); return(CreatedAtAction("GetClient", new { id = client.Id }, client)); }