public static bool Create(T_Notification notification, T_User user, T_Event myevent) { using (ConcertFinderEntities bdd = new ConcertFinderEntities()) { try { T_Event a_event = bdd.T_Event.Where(x => x.Id == myevent.Id).FirstOrDefault(); T_User a_user = bdd.T_User.Where(x => x.Id == user.Id).FirstOrDefault(); bdd.Attach(a_event); bdd.Attach(a_user); notification.T_Event.Add(a_event); notification.T_User.Add(a_user); bdd.T_Notification.AddObject(notification); bdd.SaveChanges(); } catch (Exception) { throw; } } return true; }
public static bool Deny(ForbidForm form) { T_Notification notif = new T_Notification() { Date = DateTime.Now, Titre = form.Title, Message = form.reason, Check = false }; return (DataAccess.Notification.Deny(notif, form.IdEvent)); }
public static bool Create(T_Notification notification, long id) { using (ConcertFinderEntities bdd = new ConcertFinderEntities()) { try { T_User user = bdd.T_User.Where(x => x.Id == id).FirstOrDefault(); bdd.Attach(user); notification.T_User.Add(user); bdd.AddToT_Notification(notification); bdd.SaveChanges(); } catch (Exception) { throw; } } return true; }
public static bool Deny(T_Notification notif, long idEvent) { using (ConcertFinderEntities bdd = new ConcertFinderEntities()) { try { T_Event myevent = bdd.T_Event.Include("T_User").Where(x => x.Id == idEvent).FirstOrDefault(); notif.T_Event.Add(myevent); notif.T_User.Add(myevent.T_User); bdd.AddToT_Notification(notif); bdd.SaveChanges(); return true; } catch (Exception) { throw; return false; } } }
static public bool ChangeRole(long id, string role) { if (DataAccess.User.ChangeRole(id, role)) { T_Notification notif = new T_Notification() { Titre = NotificationModel.GetStatus((int)eStatus.Status), Date = DateTime.Now, Message = "Votre statut est désormais " + role, Check = false }; return DataAccess.Notification.Create(notif, id); } return false; }
/// <summary> /// Create a new T_Notification object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="titre">Initial value of the Titre property.</param> /// <param name="date">Initial value of the Date property.</param> /// <param name="message">Initial value of the Message property.</param> public static T_Notification CreateT_Notification(global::System.Int64 id, global::System.String titre, global::System.DateTime date, global::System.String message) { T_Notification t_Notification = new T_Notification(); t_Notification.Id = id; t_Notification.Titre = titre; t_Notification.Date = date; t_Notification.Message = message; return t_Notification; }
/// <summary> /// Deprecated Method for adding a new object to the T_Notification EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_Notification(T_Notification t_Notification) { base.AddObject("T_Notification", t_Notification); }