Exemple #1
0
        public virtual Output <SalesOrderDetail_ReadOutput> Detail_Read(int _salesOrderDetailId)
        {
            // CUSTOM_CODE_START: add custom security checks for Detail_Read operation below
            // CUSTOM_CODE_END
            SalesOrderDetail_ReadOutput res = new SalesOrderDetail_ReadOutput();

            try
            {
                SalesOrderDetail obj = ctx.FindEntity <SalesOrderDetail>(currentErrors, _salesOrderDetailId);
                ServiceUtil.CopyProperties(obj, res);
                // CUSTOM_CODE_START: add custom code for Detail_Read operation below
                // CUSTOM_CODE_END
            }
            catch (Exception ex)
            {
                currentErrors.MergeWith(errorParser.FromException(ex));
            }
            return(new Output <SalesOrderDetail_ReadOutput>(currentErrors, res));
        }
Exemple #2
0
        public virtual SalesOrderDetail_ReadOutput Detail_Read(int _salesOrderDetailId)
        {
            SalesOrderDetail_ReadOutput res = new SalesOrderDetail_ReadOutput();

            using (AdventureWorksEntities ctx = new AdventureWorksEntities())
            {
                SalesOrderDetail obj = ctx.SalesOrderDetail.Find(_salesOrderDetailId);
                if (obj == null)
                {
                    ErrorList.Current.CriticalError(HttpStatusCode.NotFound, "SalesOrderDetail with id {0} not found", _salesOrderDetailId);
                }
                ServiceUtil.CopyProperties(obj, res);
                res.SalesOrderId = obj.SalesOrderObject.SalesOrderId;
                // CUSTOM_CODE_START: set the SpecialOfferId output field of Detail_Read operation below
                // TODO: res.SpecialOfferId = ???; // CUSTOM_CODE_END
                // CUSTOM_CODE_START: set the ProductId output field of Detail_Read operation below
                // TODO: res.ProductId = ???; // CUSTOM_CODE_END
                // CUSTOM_CODE_START: add custom code for Detail_Read operation below
                // CUSTOM_CODE_END
            }
            return(res);
        }
        public virtual async Task <Output <SalesOrderDetail_ReadOutput> > Detail_ReadAsync(int _salesOrderDetailId)
        {
            SalesOrderDetail_ReadOutput res = new SalesOrderDetail_ReadOutput();

            try
            {
                currentErrors.AbortIfHasErrors();

                // CUSTOM_CODE_START: add custom security checks for Detail_Read operation below
                // CUSTOM_CODE_END
                SalesOrderDetail obj = await ctx.FindEntityAsync <SalesOrderDetail>(currentErrors, _salesOrderDetailId);

                ServiceUtil.CopyProperties(obj, res);
                // CUSTOM_CODE_START: set the Subcategory output field of Detail_Read operation below
                res.Subcategory = obj.SpecialOfferProductObject.ProductObject.ProductSubcategoryId; // CUSTOM_CODE_END
                // CUSTOM_CODE_START: add custom code for Detail_Read operation below
                // CUSTOM_CODE_END
            }
            catch (Exception ex)
            {
                currentErrors.MergeWith(errorParser.FromException(ex));
            }
            return(await Task.FromResult(new Output <SalesOrderDetail_ReadOutput>(currentErrors, res)));
        }