示例#1
0
 public bool Remove(User user)
 {
     try
     {
         if (user == null)
         {
             throw new NullReferenceException();
         }
         DataAccessLayer.User userForDatabase = userMapper.MapToDatabaseType(user);
         usersRepository.Remove(userForDatabase);
         log.Info("Use deleted his/her accounts");
     }
     catch (Exception e)
     {
         log.Error(e.Message);
         return(false);
     }
     return(true);
 }
示例#2
0
 public bool Update(User updatedUser)
 {
     try
     {
         if (updatedUser == null)
         {
             throw new NullReferenceException();
         }
         DataAccessLayer.User userForDatabase = userMapper.MapToDatabaseType(updatedUser);
         usersRepository.Update(userForDatabase);
         log.Info("User updated his information");
     }
     catch (Exception e)
     {
         log.Error(e.Message);
         return(false);
     }
     return(true);
 }
示例#3
0
 public bool Register(User user)
 {
     try
     {
         if (user == null)
         {
             throw new NullReferenceException();
         }
         if (user.Avatar == "/Content/img/Avatars/no_avatar")
         {
             user.Avatar = "~/Content/img/Avatars/avatar.jpg";
         }
         DataAccessLayer.User userForDatabase = userMapper.MapToDatabaseType(user);
         usersRepository.Register(userForDatabase);
         log.Info("User successfully registered");
     }
     catch (Exception e)
     {
         log.Error(e.Message);
         return(false);
     }
     return(true);
 }