/// <summary> /// Deprecated Method for adding a new object to the favori EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTofavori(favori favori) { base.AddObject("favori", favori); }
public JsonResult EnregistrerFavori(FavoriFormView favView) { if (ModelState.IsValid) { // test des droits de modif if (favView.id_employeFav != this.getCurrentUtilisateur().id_employe) return Json(new { succes = 0, message = "Vous n'êtes pas autorisé à modifier les favoris" }); //vérification que le favori n'existe pas déjà if (cnx.favori.Where(f => f.id_type_temps == favView.id_type_tempsFav && f.id_employe == favView.id_employeFav && f.id_projet == favView.id_projetFav && f.id_tache == favView.id_tacheFav).Any()) return Json(new { succes = 0, message = "Le favori existe déjà" }); favori fav = new favori(); fav.UpdateFromView(favView); cnx.AddTofavori(fav); cnx.SaveChanges(); return Json(new { succes = 1 }); } return Json(new { succes = 0, message = "Le favori n'a pas été rajouté" }); }
/// <summary> /// Create a new favori object. /// </summary> /// <param name="id_favori">Initial value of the id_favori property.</param> /// <param name="id_type_temps">Initial value of the id_type_temps property.</param> /// <param name="id_tache">Initial value of the id_tache property.</param> /// <param name="id_projet">Initial value of the id_projet property.</param> /// <param name="id_employe">Initial value of the id_employe property.</param> public static favori Createfavori(global::System.Int32 id_favori, global::System.Int32 id_type_temps, global::System.Int32 id_tache, global::System.Int32 id_projet, global::System.Int32 id_employe) { favori favori = new favori(); favori.id_favori = id_favori; favori.id_type_temps = id_type_temps; favori.id_tache = id_tache; favori.id_projet = id_projet; favori.id_employe = id_employe; return favori; }