public async Task <IActionResult> UpdateAlumno(int id, AlumnoForUpdateDto alumnoDto) { Alumno AluFromRepo = await this.repo.GetOne(id); AluFromRepo.FechaModificacion = DateTime.Now; this.mapper.Map(alumnoDto, AluFromRepo); if (await this.repo.SaveAll()) { return(NoContent()); } throw new Exception($"Updating Alumno {id} failed on save"); }
public async Task <IActionResult> CreateAlumno(AlumnoForUpdateDto alumnoDto) { Alumno alumnoNew = new Alumno(); alumnoNew.FechaModificacion = DateTime.Now; this.mapper.Map(alumnoDto, alumnoNew); this.repo.Add(alumnoNew); if (await this.repo.SaveAll()) { return(NoContent()); } throw new Exception($"Creating Alumno failed on save"); }