Beispiel #1
0
 public static void AddMessage(Message message)
 {
     using (var context = new MessageDBContext())
     {
         context.Messages.Add(message);
     }
 }
Beispiel #2
0
 public static List <User> GetAllUsers(Guid messageGuid)
 {
     using (var context = new MessageDBContext())
     {
         return(context.Users.Where(u => u.Messages.All(r => r.Guid != messageGuid)).ToList());
     }
 }
Beispiel #3
0
 public static User GetUserByGuid(Guid guid)
 {
     using (var context = new MessageDBContext())
     {
         return(context.Users.Include(u => u.Messages).FirstOrDefault(u => u.Guid == guid));
     }
 }
Beispiel #4
0
 public static User GetUserByLogin(string login)
 {
     using (var context = new MessageDBContext())
     {
         return(context.Users.Include(u => u.Messages).FirstOrDefault(u => u.Login == login));
     }
 }
Beispiel #5
0
 public static bool UserExists(string login)
 {
     using (MessageDBContext context = new MessageDBContext())
     {
         return(context.Users.Any(u => u.Login == login));
     }
 }
Beispiel #6
0
 public static void SaveMessage(Message message)
 {
     using (var context = new MessageDBContext())
     {
         context.Entry(message).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #7
0
 public static void AddUser(User user)
 {
     using (var context = new MessageDBContext())
     {
         context.Users.Add(user);
         context.SaveChanges();
     }
 }