public List <FormateurModel> GetAllFormateurs() { string[] lines = GetText("FormateurFile.txt"); List <FormateurModel> List = new List <FormateurModel>(); foreach (string line in lines) { string[] stg = line.Split(','); int id = Convert.ToInt16(stg[0]); FormateurModel model = new FormateurModel(id, stg[1].ToString(), stg[2].ToString(), stg[3].ToString() == "F" ? Sexe.F : Sexe.M, Convert.ToDateTime(stg[4].ToString())); List.Add(model); } return(List); }
public List <FormateurModel> GetAllFormateurs() { List <FormateurModel> List = new List <FormateurModel>(); DataTable dt = opre.GetDataTabel("GetAllFormateurs"); foreach (DataRow dr in dt.Rows) { int id = Convert.ToInt16(dr[0]); FormateurModel model = new FormateurModel(id, dr[1].ToString(), dr[2].ToString(), dr[3].ToString() == "F" ? Sexe.F : Sexe.M, Convert.ToDateTime(dr[4].ToString())); List.Add(model); } return(List); }
public async Task <IActionResult> PostFormateur(FormateurModel formateur) { if (formateur is null) { throw new ArgumentNullException(nameof(formateur)); } var Organisme = new FormateurModel() { Theme = formateur.Theme, Organisme_prestataire = formateur.Organisme_prestataire, Nom_Formateur = formateur.Nom_Formateur, Period = formateur.Period, Score = formateur.Score, }; var resultat = await _context.Formateurs.AddAsync(Organisme); _context.SaveChanges(); return(Ok(formateur)); }