public async Task <IActionResult> PutEnrollement(int id, EnrollementViewModel Enrollement) { try { var p = _mapper.Map <Enrollement>(Enrollement); p.Id = id; _EnrollementRepository.Update(p); await _EnrollementRepository.SaveAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }
public async Task <Enrollement> PostEnrollement(EnrollementViewModel Enrollement) { try { var p = _mapper.Map <Enrollement>(Enrollement); p.Type = "Groupe"; await _EnrollementRepository.InsertAsync(p); await _EnrollementRepository.SaveAsync(); return(await _EnrollementRepository.GetByIdAsync(p.Id)); } catch (Exception e) { throw e; } }