public async Task <IActionResult> Create([FromBody] CreateProductionInformationRequest productionInformationRequest) { var productionInformation = new ProductionInformation { House = productionInformationRequest.House, Customer = productionInformationRequest.Customer, ExteriorWalls = productionInformationRequest.ExteriorWalls, Ventilation = productionInformationRequest.Ventilation, Note = productionInformationRequest.Note, ProductionPrice = productionInformationRequest.ProductionPrice, ProductionDate = productionInformationRequest.ProductionDate, LastUpdatedDate = productionInformationRequest.LastUpdatedDate, LastUpdatedBy = productionInformationRequest.LastUpdatedBy, IsActive = productionInformationRequest.IsActive }; await _productionInformationsService.CreateAsync(productionInformation); var baseurl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}"; var locationuri = baseurl + "/" + ApiRoutes.ProductionInformations.Get.Replace("{productionInformationId}", productionInformation.Id.ToString()); var response = ProdInfoToProdInfoResponse(productionInformation); return(Created(locationuri, response)); }
public async Task <ProductionInformation> GetByIdAsync(int id) { string cmd = $@"SELECT p.*, pi.*, g.* FROM `production` p LEFT JOIN `production_image` pi ON p.production_image_id = pi.id LEFT JOIN `gtin` g ON p.gtin_id = g.id WHERE p.`id` = '{id}' and p.`is_deleted` = 0"; var conn = DbConnection; if (conn == null) { conn = DALHelper.GetConnection(); } try { using (var reader = await conn.QueryMultipleAsync(cmd, transaction: DbTransaction)) { return(reader.Read <Production, ProductionImage, GTIN, ProductionInformation>( (productionRs, imageRs, gTINRs) => { ProductionInformation production = null; if (productionRs != null) { var serializedParent = JsonConvert.SerializeObject(productionRs); production = JsonConvert.DeserializeObject <ProductionInformation>(serializedParent); } else { production = new ProductionInformation(); } if (imageRs != null) { var serializedParent = JsonConvert.SerializeObject(imageRs); production.ProductionImage = JsonConvert.DeserializeObject <ProductionImageData>(serializedParent); } if (gTINRs != null) { production.GTIN = gTINRs.ToInformation(); } return production; } ).FirstOrDefault()); } } catch (Exception) { throw; } finally { if (DbConnection == null) { conn.Dispose(); } } }
public BuildingDescription(VerbalStructureDescription verbalStructureDescription, Knowledge unlockCost, ConstructionInformation constructionInformation, ProductionInformation productionInformation, RenderInformation renderInformation, bool canExtractWater) { ConstructionInformation = constructionInformation; ProductionInformation = productionInformation; RenderInformation = renderInformation; CanExtractWater = canExtractWater; VerbalStructureDescription = verbalStructureDescription; UnlockCost = unlockCost; }
public static Rent GenerateTestRent (ProductionInformation productionInformation, DateTime startDate, DateTime endDate, float rentPrice = 10000, float insurancePrice = 5000) { return(new Rent { ProductionInformation = productionInformation, RentPrice = rentPrice, InsurancePrice = insurancePrice, StartDate = startDate, EndDate = endDate, }); }
public static ProductionInformationResponse ProdInfoToProdInfoResponse(ProductionInformation prodInfo) { return(new ProductionInformationResponse { Id = prodInfo.Id, HouseId = prodInfo.HouseId, Rents = prodInfo.Rents, Customer = prodInfo.Customer, ExteriorWalls = prodInfo.ExteriorWalls, Ventilation = prodInfo.Ventilation, Note = prodInfo.Note, ProductionPrice = prodInfo.ProductionPrice, AdditionalCosts = prodInfo.AdditionalCosts, LastUpdatedBy = prodInfo.LastUpdatedBy.Email, LastUpdatedDate = prodInfo.LastUpdatedDate, IsActive = prodInfo.IsActive }); }
public InsertProductionCommand(ProductionInformation production) { Model = production; }
public UpdateProductionCommand(ProductionInformation production) { Model = production; }