示例#1
0
        public PurchaseOrderResponse Post(CreatePurchaseOrder request)
        {
            try
            {
                PurchaseOrderModel result = request.ConvertTo <PurchaseOrderModel>();
                purchaseOrderRepository.Create(result);

                return(result.ConvertTo <PurchaseOrderResponse>());
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Something went wrong while posting PO.");
                throw;
            }
        }
示例#2
0
        public PurchaseOrderResponse Get(GetPurchaseOrder request)
        {
            try
            {
                PurchaseOrderModel purchaseOrder = purchaseOrderRepository.Find(request.Id);
                if (purchaseOrder == default(PurchaseOrderModel))
                {
                    throw HttpError.NotFound($"There is no PurchaseOrder with Id:{request.Id}");
                }

                return(purchaseOrder.ConvertTo <PurchaseOrderResponse>());
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Something went wrong while getting PO.");
                throw;
            }
        }