public async Task <IActionResult> Update(Guid societyId, Guid id, [FromBody] BuildingUpdate building) { if (building == null) { return(BadRequest()); } var societyExists = await this._societyService.IsExistsAsync(societyId); if (!societyExists) { return(NotFound()); } var buildingExists = await this._buildingService.IsBuildingInSocietyExistsAsync(societyId, id); if (!buildingExists) { return(NotFound()); } building.UpdatedBy = this.LoggedInUserId; building.UpdatedDate = DateTime.UtcNow; var response = await this._buildingService.UpdateAsync(societyId, id, building); if (response.Successful) { return(NoContent()); // return Ok(response.Data); } return(BadRequest(response.ErrorMessages)); }
public void SetItem(GameObject go) { hasPlaced = false; myBuilding = (GameObject)GameObject.Instantiate(go); currentBuilding = myBuilding.transform; curBuilding = myBuilding.GetComponent<BuildingUpdate>(); }
public async Task <ServiceResponse <Building> > UpdateAsync(Guid societyId, Guid buildingId, BuildingUpdate building) { var validator = new BuildingUpdateValidator(); var results = validator.Validate(building); var response = new ServiceResponse <Building>(); response.ErrorMessages = results.Errors.ToList(); if (!response.Successful) { return(response); } var updatedEntity = AutoMapper.Mapper.Map <Apollo.Domain.Entity.Society.Building>(building); updatedEntity.Id = buildingId; updatedEntity.SocietyId = societyId; var result = await this._buildingRepository.UpdateAsync(updatedEntity); response.Data = AutoMapper.Mapper.Map <Apollo.Domain.DTO.Society.Building>(result); return(response); }