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); }
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); }
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); }