예제 #1
0
 public void PutEleve(int id, Eleve eleve)
 {
     eleve.Id = id;
     if (!repository.Update(eleve))
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
예제 #2
0
 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());
 }