public ServiceRespond ChangePassword(int userId, string oldPassword, string newPassword, string repeatNewPassword) { using (IBoardGameServices service = serviceBulider.Bulid()) { return Mapping.Mapper.Map<ServiceRespond>(service.UserService.ChangePassword(userId, oldPassword, newPassword, repeatNewPassword)); } }
public UserRespond Login(string email, string password) { using (IBoardGameServices service = serviceBulider.Bulid()) { return Mapping.Mapper.Map<UserRespond>(service.UserService.Login(email, password)); } }
public ServiceRespond Registration(User user, string password, string repeatPassword) { using (IBoardGameServices service = serviceBulider.Bulid()) { DbModel.User userDb = Mapping.Mapper.Map<DbModel.User>(user); return Mapping.Mapper.Map<ServiceRespond>(service.UserService.Registration(userDb, password, repeatPassword)); } }
public void ConnectPlayersToMatch(GameTypes gameType) { try { if (!SearchForMetchUsers.Any()) { return; } //Zrobić refaktor //może się przydać lock var first = SearchForMetchUsers.FirstOrDefault(f => f.GameType == gameType); if (first == null) { return; } var secend = SearchForMetchUsers.FirstOrDefault(f => f.GameType == gameType && f.UserId != first.UserId); if (secend == null) { return; } using (IBoardGameServices service = serviceBulider.Bulid()) { SearchForMetchUsers.Remove(first); SearchForMetchUsers.Remove(secend); List <int> userList = new List <int> { first.UserId, secend.UserId }; //Pomyśłec co z GameData!!!! Wstępnie niech trzyma dane historyczne. Nie jest potrzebny przy created MatchServiceResponse respons = service.MatchService.Create(new CreateMatch { GameType = (int)gameType, UserIdList = userList }); if (respons.Status == ServiceRespondStatus.Error) { //Czemu exception, Nie powino być sytuacji że tego nie zapisze. Jeszcze to przemyśleć throw new Exception(String.Join(String.Empty, respons.Messages.SelectMany(s => s.Key + " - " + s.Value + ". "))); } IGamePlay gamepPlay = new GamePlay(); gamepPlay.Match = Mapping.Mapper.Map <Match>(respons.Match); this.PlayedMatches.Add(gamepPlay); } } catch (Exception ex) { } }