public void PutEleve(int id, Eleve eleve) { eleve.Id = id; if (!repository.Update(eleve)) { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public async Task <IActionResult> PutEleve(int id, EleveViewModel eleve) { try { var p = _mapper.Map <Eleve>(eleve); p.Id = id; _eleveRepository.Update(p); await _eleveRepository.SaveAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }