public static CorsoDocenteDTO ToDTO(this CorsoDocente corsoDocente) { if (corsoDocente == null) { return(null); } return(new CorsoDocenteDTO { IdEdizioneCorso = corsoDocente.IdEdizioneCorso, IdDocente = corsoDocente.IdDocente, ValutazioneMedia = corsoDocente.ValutazioneMedia }); }
public IActionResult Post([FromBody] CorsoDocenteDTO value) { if (value == null) { return(BadRequest()); } CorsoDocente Docente = value.ToCorsoDocente(); work.Begin(); work.CorsiDocentiRepo.Add(Docente); work.Save(); work.End(); return(CreatedAtRoute("ROUTE_GET_COURSE", new { id = Docente.IdEdizioneCorso }, Docente.ToDTO())); //return CreatedAtAction("GetCorsoDocente", new { id = corsoDocente.IdDocente }, corsoDocente); }
public IActionResult Get(int id) //GetCorsoDocente anche { CorsoDocente corso = context.CorsiDocenti.Find(id); if (corso == null) { return(NotFound()); } return(Ok(corso)); //if (id < 1) //{ // return BadRequest(); //} //var corsoDocente = work.CorsiDocentiRepo.FindAll().Select(cd => cd.ToDTO()); // 26' PER QUESTA RIGA //if (corsoDocente == null) //{ // return NotFound(); //} //return Ok(corsoDocente); }
public void Update(CorsoDocente corsoDocente) { throw new NotImplementedException(); }
//IEnumerable<CorsoDocente> ICorsiDocentiRepository.FindByName(string s) //{ // throw new NotImplementedException(); //} void ICorsiDocentiRepository.Update(CorsoDocente corsoDocente) { throw new NotImplementedException(); }
public void Add(CorsoDocente corsoDocente) { context.CorsiDocenti.Add(corsoDocente); context.SaveChanges(); }