Example #1
0
 public IActionResult AggiungiStudente([FromBody] StudenteModels s)
 {
     if (s.Corso != null)
     {
         try
         {
             repository.IscriviStudente(s.AsStudente(), s.Corso);
             return(Ok(s));
         }
         catch (Exception)
         {
             return(BadRequest());
         }
     }
     else
     {
         try
         {
             repository.AggiungiStudente(s.AsStudente());
             return(Ok(s));
         }
         catch (Exception)
         {
             return(BadRequest());
         }
     }
 }