Example #1
0
 /// <summary>
 ///     Change the role of a user in Odin_UserRoles
 /// </summary>
 /// <param name="userName">Name of the user</param>
 /// <param name="role">New role</param>
 public void UpdateUserRole(string userName, string role)
 {
     using (OdinContext context = this.contextFactory.CreateContext())
     {
         OdinUserRoles odinUserRoles = (from o in context.OdinUserRoles where o.Username == userName select o).FirstOrDefault();
         if (odinUserRoles != null)
         {
             odinUserRoles.Role = role;
             context.SaveChanges();
         }
     }
 }
Example #2
0
 /// <summary>
 ///     Updates the current users notification number to the current number
 /// </summary>
 public void UpdateUserNotification()
 {
     using (OdinContext context = this.contextFactory.CreateContext())
     {
         OdinUserRoles odinUserRoles = (from o in context.OdinUserRoles where o.Username == GlobalData.UserName select o).FirstOrDefault();
         if (odinUserRoles != null)
         {
             odinUserRoles.NotificationNumber = GlobalData.NotificationNumber;
             context.SaveChanges();
         }
     }
 }