public async Task PopulateRoomAsync(int roomId, [FromBody] PopulationDto populationDto) { if (ModelState.IsValid) { await _service.PopulateRoomAsync(roomId, populationDto); } else { throw new Exception("Invalid DTO model"); } }
public bool RegisterMember(PopulationDto member) { logger.Info(Constant.Messages.BllRegisterMember); if (house.GetHouse(member.CensusHouseNumber) != null) { return(populationdal.RegisterMember(member)); } else { return(false); } }
private void GeneratePopulation(PopulationDto population) { int noOfCreatures = population.creatures.Count; for (int i = 0; i < noOfCreatures; i++) { Vector3 creaturePos = new Vector3((noOfCreatures / 2 - i) * 0.2f, 0.2f, 0); GameObject creature = Instantiate(creaturePrefab, creaturePos, Quaternion.identity); creature.GetComponent <CreatureController>().id = population.creatures[i].id; creatures.Add(creature); } GenerateObstacles(); isGenerating = false; }
//Register new Member public bool RegisterMember(PopulationDto memberdto) { appContext.Database.Log = s => { System.Diagnostics.Debug.WriteLine(s); }; memberEntity = mapper.Map <Population>(memberdto); try { appContext.Population.Add(memberEntity); appContext.SaveChanges(); return(true); } catch (Exception) { return(false); } }
/// <summary> /// Заселить комнату /// </summary> /// <param name="roomDto">DTO комнаты</param> /// <param name="populationDto">Информация для заселения</param> public void PopulateRoom(RoomDto roomDto, PopulationDto populationDto) { _hotelProvider.PopulateRoom(roomDto.Id, populationDto); }