public void UpdateUserWeaponInUse(UserWeapon userWeapon) { if (userWeapon.Weapon.MinimumLevel > userWeapon.User.Level) { throw new BeerException("You do not have the enough level yet !"); } _context.UpdateUserWeaponInUse(userWeapon); UpdateBeerUserInformations(BeerCalculationService.CharacteristicsCalculation(userWeapon.User, userWeapon.Weapon)); }
public void UpdateUserWeaponInUse(int userWeaponId) { var userWeapon = GetUserWeaponById(userWeaponId); if (userWeapon == null) { throw new BeerException("Can't find the weapon !"); } UpdateUserWeaponInUse(userWeapon); UpdateBeerUserInformations(BeerCalculationService.CharacteristicsCalculation(userWeapon.User, userWeapon.Weapon)); }
public List <BeerUser> GetAllBeerUsers() { // Update characteristics of all gamers. var beerUsers = _context.GetAllBeerUsers(); foreach (var u in beerUsers) { UpdateBeerUserInformations(BeerCalculationService.CharacteristicsCalculation(u, GetUserWeaponInUse(u).Weapon)); } return(_context.GetAllBeerUsers()); }
public BeerUser UpdateBeerUserAddExperienceAndMoney(BeerUser beerUser, Weapon weapon) { BeerCalculationService.AddExperience(beerUser, weapon); beerUser.Money += 10; return(_context.UpdateBeerUser(beerUser)); }
public void UpdateBeerUserCharacteristics(BeerUser beerUser, Weapon weapon) { BeerCalculationService.CharacteristicsCalculation(beerUser, weapon); _context.UpdateBeerUser(beerUser); }