コード例 #1
0
        public Stock ConvertDTOToEntity(StockDetail_StockDTO StockDetail_StockDTO)
        {
            Stock Stock = new Stock();

            Stock.Id          = StockDetail_StockDTO.Id;
            Stock.ItemId      = StockDetail_StockDTO.ItemId;
            Stock.WarehouseId = StockDetail_StockDTO.WarehouseId;
            Stock.Quantity    = StockDetail_StockDTO.Quantity;
            return(Stock);
        }
コード例 #2
0
        public async Task <StockDetail_StockDTO> Get([FromBody] StockDetail_StockDTO StockDetail_StockDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            Stock Stock = await StockService.Get(StockDetail_StockDTO.Id);

            return(new StockDetail_StockDTO(Stock));
        }
コード例 #3
0
        public async Task <ActionResult <StockDetail_StockDTO> > Update([FromBody] StockDetail_StockDTO StockDetail_StockDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            Stock Stock = ConvertDTOToEntity(StockDetail_StockDTO);

            Stock = await StockService.Update(Stock);

            StockDetail_StockDTO = new StockDetail_StockDTO(Stock);
            if (Stock.IsValidated)
            {
                return(StockDetail_StockDTO);
            }
            else
            {
                return(BadRequest(StockDetail_StockDTO));
            }
        }