public async Task <IActionResult> Post(string adress, int homemates, int floors) { House house = null; if (!string.IsNullOrWhiteSpace(adress)) { house = new House() { Adress = adress, NumberOfHomemates = homemates, Floors = floors } } ; if (house == null) { logger.LogInformation($"{DateTime.Now.ToString()} POST request returned BadRequest"); return(BadRequest()); } logger.LogInformation($"{DateTime.Now.ToString()} POST request. House with name={adress}, NumberOfHomemates={homemates}, Floors = {floors} was successfully created"); await service.AddAsync(house); return(Ok(house)); }
public void Initialize() { if (service.GetAllAsync().Result.Count == 0) { { service.AddAsync(new House { Adress = "Sumskaya38", NumberOfHomemates = 20, Floors = 5 }); } } }