public async Task <Building> SaveBuilding(BuildingDataDto building) { var bldg = await _buildingsRepo.GetFirstOrDefault(b => b.Id == building.Id); if (bldg != null) { bldg.Name = building.Name; bldg.Number = building.Number; bldg.BuildingCategoryId = building.BuildingCategoryId; bldg.Sector = (building.Sector != null) ? building.Sector : ""; } await _buildingsRepo.SaveAsync(); return(bldg); }
public async Task <IActionResult> SaveBuilding([FromBody] BuildingDataDto building) { var bldg = await _buildingService.SaveBuilding(building); return(Ok()); }