Exemple #1
0
        public ActionResult <ProductionLine> PostProductionLine(ProductionLine productionLine)
        {
            _productionLineRepository.Add(productionLine);
            _productionLineRepository.SaveChanges();

            return(CreatedAtAction(nameof(GetProductionLine), new { id = productionLine.Id }, productionLine));
        }
Exemple #2
0
        public ActionResult <ProductionLine> PostProductionLine(ProductionLineDTO DTO)
        {
            ProductionLine productionLine = new ProductionLine(DTO.Name);

            productionLine.Machines = DTO.Machines;
            _productionLineRepository.Add(productionLine);
            _productionLineRepository.SaveChanges();

            return(CreatedAtAction(nameof(GetProductionLine), new { id = productionLine.Id }, productionLine));
        }
Exemple #3
0
 private async Task <CompleteMaintenanceResult> InvokeCompleteMaintenance(Func <Result <Exception> > action, Domain.Production.ProductionLine productionLine)
 {
     return(await action().Match(
                success: async _ =>
     {
         var addResult = await productionLineRepository.Add(productionLine);
         var shutDownProductionLineResult = addResult.Match <CompleteMaintenanceResult>(
             success => new CompleteMaintenanceResult.Success(),
             notReachable => new CompleteMaintenanceResult.NotReachable(),
             error => new CompleteMaintenanceResult.Error(error.Exception)
             );
         return shutDownProductionLineResult;
     },
                failure: failure => Task.FromResult <CompleteMaintenanceResult>(new CompleteMaintenanceResult.Error(failure.Error))
                ));
 }