Beispiel #1
0
 public bool AddUser(User user)
 {
     using (var entity = new WakeOrWasteEntities())
     {
         entity.Configuration.ProxyCreationEnabled = false;
         var rs = entity.Users.Add(user);
         entity.SaveChanges();
         return rs != null;
     }
 }
Beispiel #2
0
 public bool CreateNewUser(User user)
 {
     return _core.AddUser(user);
 }
Beispiel #3
0
 /// <summary>
 /// Update User
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool UpdateUser(User user)
 {
     return _core.UpdateUser(user);
 }
Beispiel #4
0
 public bool UpdateUser(User user)
 {
     using (var entity = new WakeOrWasteEntities())
     {
         entity.Configuration.ProxyCreationEnabled = false;
         var userToUpdated = entity.Users.FirstOrDefault(u => u.Id == user.Id);
         if (userToUpdated != null)
         {
             userToUpdated.Name = user.Name;
             userToUpdated.ImageUrl = user.ImageUrl;
             entity.SaveChanges();
             return true;
         }
         return false;
     }
 }