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); }
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)); }
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)); } }