Beispiel #1
0
 public virtual IActionResult ExportWarehouses()
 {
     try
     {
         logger.LogInformation("Exporting warehouse hierarchy");
         Business.Warehouse wh        = this.warehouseManagementLogic.ExportWarehouse();
         Warehouse          wareHouse = this.mapper.Map <Warehouse>(wh);
         return(StatusCode(200, wareHouse));
     }
     catch (BusinessLayerException e)
     {
         throw new ServiceLayerException("BL Exception", e);
     }
 }
Beispiel #2
0
 public virtual IActionResult ImportWarehouses([FromBody] Warehouse body)
 {
     try
     {
         logger.LogInformation("Importing warehouse hierarchy");
         Business.Warehouse import = this.mapper.Map <Business.Warehouse>(body);
         this.warehouseManagementLogic.ImportWarehouse(import);
         return(StatusCode(200));
     }
     catch (BusinessLayerException e)
     {
         throw new ServiceLayerException("BL Exception", e);
     }
 }
Beispiel #3
0
        public virtual IActionResult GetWarehouse([FromRoute][Required] string code)
        {
            //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(200, default(Hop));

            //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(400, default(Error));

            //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(404);



            try
            {
                logger.LogInformation("Exporting warehouse hierarchy");
                Business.Warehouse wh        = this.warehouseManagementLogic.ExportWarehouseCode(code);
                Warehouse          wareHouse = this.mapper.Map <Warehouse>(wh);
                return(StatusCode(200, wareHouse));
            }
            catch (BusinessLayerException e)
            {
                throw new ServiceLayerException("BL Exception", e);
            }

            /*
             * string exampleJson = null;
             * exampleJson = "{\n  \"code\" : \"code\",\n  \"locationName\" : \"locationName\",\n  \"processingDelayMins\" : 0,\n  \"hopType\" : \"hopType\",\n  \"description\" : \"description\",\n  \"locationCoordinates\" : {\n    \"lon\" : 1.4658129805029452,\n    \"lat\" : 6.027456183070403\n  }\n}";
             *
             *          var example = exampleJson != null
             *          ? JsonConvert.DeserializeObject<Hop>(exampleJson)
             *          : default(Hop);            //TODO: Change the data returned
             * return new ObjectResult(example);
             *
             */
        }