Ejemplo n.º 1
0
        public async Task <Product_PaymentMethod> Get(long ProductId, long PaymentMethodId)
        {
            Product_PaymentMethod Product_PaymentMethod = await DataContext.Product_PaymentMethod.Where(x => x.ProductId == ProductId && x.PaymentMethodId == PaymentMethodId).Select(Product_PaymentMethodDAO => new Product_PaymentMethod()
            {
                ProductId       = Product_PaymentMethodDAO.ProductId,
                PaymentMethodId = Product_PaymentMethodDAO.PaymentMethodId,
                PaymentMethod   = Product_PaymentMethodDAO.PaymentMethod == null ? null : new PaymentMethod
                {
                    Id          = Product_PaymentMethodDAO.PaymentMethod.Id,
                    Code        = Product_PaymentMethodDAO.PaymentMethod.Code,
                    Name        = Product_PaymentMethodDAO.PaymentMethod.Name,
                    Description = Product_PaymentMethodDAO.PaymentMethod.Description,
                },
                Product = Product_PaymentMethodDAO.Product == null ? null : new Product
                {
                    Id                      = Product_PaymentMethodDAO.Product.Id,
                    Code                    = Product_PaymentMethodDAO.Product.Code,
                    Name                    = Product_PaymentMethodDAO.Product.Name,
                    Description             = Product_PaymentMethodDAO.Product.Description,
                    TypeId                  = Product_PaymentMethodDAO.Product.TypeId,
                    StatusId                = Product_PaymentMethodDAO.Product.StatusId,
                    MerchantId              = Product_PaymentMethodDAO.Product.MerchantId,
                    CategoryId              = Product_PaymentMethodDAO.Product.CategoryId,
                    BrandId                 = Product_PaymentMethodDAO.Product.BrandId,
                    WarrantyPolicy          = Product_PaymentMethodDAO.Product.WarrantyPolicy,
                    ReturnPolicy            = Product_PaymentMethodDAO.Product.ReturnPolicy,
                    ExpiredDate             = Product_PaymentMethodDAO.Product.ExpiredDate,
                    ConditionOfUse          = Product_PaymentMethodDAO.Product.ConditionOfUse,
                    MaximumPurchaseQuantity = Product_PaymentMethodDAO.Product.MaximumPurchaseQuantity,
                },
            }).FirstOrDefaultAsync();

            return(Product_PaymentMethod);
        }
Ejemplo n.º 2
0
        public async Task <bool> Delete(Product_PaymentMethod Product_PaymentMethod)
        {
            Product_PaymentMethodDAO Product_PaymentMethodDAO = await DataContext.Product_PaymentMethod.Where(x => x.ProductId == Product_PaymentMethod.ProductId && x.PaymentMethodId == Product_PaymentMethod.PaymentMethodId).FirstOrDefaultAsync();

            DataContext.Product_PaymentMethod.Remove(Product_PaymentMethodDAO);
            await DataContext.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 3
0
        public async Task <bool> Update(Product_PaymentMethod Product_PaymentMethod)
        {
            Product_PaymentMethodDAO Product_PaymentMethodDAO = DataContext.Product_PaymentMethod.Where(x => x.ProductId == Product_PaymentMethod.ProductId && x.PaymentMethodId == Product_PaymentMethod.PaymentMethodId).FirstOrDefault();

            Product_PaymentMethodDAO.ProductId       = Product_PaymentMethod.ProductId;
            Product_PaymentMethodDAO.PaymentMethodId = Product_PaymentMethod.PaymentMethodId;
            await DataContext.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 4
0
        public async Task <bool> Create(Product_PaymentMethod Product_PaymentMethod)
        {
            Product_PaymentMethodDAO Product_PaymentMethodDAO = new Product_PaymentMethodDAO();

            Product_PaymentMethodDAO.ProductId       = Product_PaymentMethod.ProductId;
            Product_PaymentMethodDAO.PaymentMethodId = Product_PaymentMethod.PaymentMethodId;

            await DataContext.Product_PaymentMethod.AddAsync(Product_PaymentMethodDAO);

            await DataContext.SaveChangesAsync();

            return(true);
        }