public async Task <bool> Delete(Product_MerchantAddress Product_MerchantAddress)
        {
            Product_MerchantAddressDAO Product_MerchantAddressDAO = await DataContext.Product_MerchantAddress.Where(x => x.ProductId == Product_MerchantAddress.ProductId && x.MerchantAddressId == Product_MerchantAddress.MerchantAddressId).FirstOrDefaultAsync();

            DataContext.Product_MerchantAddress.Remove(Product_MerchantAddressDAO);
            await DataContext.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> Update(Product_MerchantAddress Product_MerchantAddress)
        {
            Product_MerchantAddressDAO Product_MerchantAddressDAO = DataContext.Product_MerchantAddress.Where(x => x.ProductId == Product_MerchantAddress.ProductId && x.MerchantAddressId == Product_MerchantAddress.MerchantAddressId).FirstOrDefault();

            Product_MerchantAddressDAO.ProductId         = Product_MerchantAddress.ProductId;
            Product_MerchantAddressDAO.MerchantAddressId = Product_MerchantAddress.MerchantAddressId;
            await DataContext.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> Create(Product_MerchantAddress Product_MerchantAddress)
        {
            Product_MerchantAddressDAO Product_MerchantAddressDAO = new Product_MerchantAddressDAO();

            Product_MerchantAddressDAO.ProductId         = Product_MerchantAddress.ProductId;
            Product_MerchantAddressDAO.MerchantAddressId = Product_MerchantAddress.MerchantAddressId;

            await DataContext.Product_MerchantAddress.AddAsync(Product_MerchantAddressDAO);

            await DataContext.SaveChangesAsync();

            return(true);
        }
        public async Task <Product_MerchantAddress> Get(long ProductId, long MerchantAddressId)
        {
            Product_MerchantAddress Product_MerchantAddress = await DataContext.Product_MerchantAddress.Where(x => x.ProductId == ProductId && x.MerchantAddressId == MerchantAddressId).Select(Product_MerchantAddressDAO => new Product_MerchantAddress()
            {
                ProductId         = Product_MerchantAddressDAO.ProductId,
                MerchantAddressId = Product_MerchantAddressDAO.MerchantAddressId,
                MerchantAddress   = Product_MerchantAddressDAO.MerchantAddress == null ? null : new MerchantAddress
                {
                    Id         = Product_MerchantAddressDAO.MerchantAddress.Id,
                    MerchantId = Product_MerchantAddressDAO.MerchantAddress.MerchantId,
                    Code       = Product_MerchantAddressDAO.MerchantAddress.Code,
                    Address    = Product_MerchantAddressDAO.MerchantAddress.Address,
                    Contact    = Product_MerchantAddressDAO.MerchantAddress.Contact,
                    Phone      = Product_MerchantAddressDAO.MerchantAddress.Phone,
                },
                Product = Product_MerchantAddressDAO.Product == null ? null : new Product
                {
                    Id                      = Product_MerchantAddressDAO.Product.Id,
                    Code                    = Product_MerchantAddressDAO.Product.Code,
                    Name                    = Product_MerchantAddressDAO.Product.Name,
                    Description             = Product_MerchantAddressDAO.Product.Description,
                    TypeId                  = Product_MerchantAddressDAO.Product.TypeId,
                    StatusId                = Product_MerchantAddressDAO.Product.StatusId,
                    MerchantId              = Product_MerchantAddressDAO.Product.MerchantId,
                    CategoryId              = Product_MerchantAddressDAO.Product.CategoryId,
                    BrandId                 = Product_MerchantAddressDAO.Product.BrandId,
                    WarrantyPolicy          = Product_MerchantAddressDAO.Product.WarrantyPolicy,
                    ReturnPolicy            = Product_MerchantAddressDAO.Product.ReturnPolicy,
                    ExpiredDate             = Product_MerchantAddressDAO.Product.ExpiredDate,
                    ConditionOfUse          = Product_MerchantAddressDAO.Product.ConditionOfUse,
                    MaximumPurchaseQuantity = Product_MerchantAddressDAO.Product.MaximumPurchaseQuantity,
                },
            }).FirstOrDefaultAsync();

            return(Product_MerchantAddress);
        }