Пример #1
0
 public static B2C_ECEntities GetInstance()
 {
     if (_instance == null)
     {
         _instance = new B2C_ECEntities();
     }
     return(_instance);
 }
Пример #2
0
 public string GetImageDefaultAllByProductId(int ProductId)
 {
     ProductImage ProductImage = GetImageDefaultByProductId(ProductId);
     if (ProductImage != null)
     {
         return ProductImage.Image;
     }
     ProductImage = new B2C_ECEntities().ProductImages.Where(p => p.Product_ID == ProductId).FirstOrDefault();
     if (ProductImage != null && !string.IsNullOrEmpty(ProductImage.Image))
     {
         return ProductImage.Image;
     }
     return "no-image.png";
 }
Пример #3
0
 public int UpdateStatus(int orderID, int statusID)
 {
     try
     {
         using (var context = new B2C_ECEntities())
         {
             context.Orders.Find(orderID).OrderStatus_ID = statusID;
             return(context.SaveChanges());
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #4
0
        public string GetImageDefaultAllByProductId(int ProductId)
        {
            ProductImage ProductImage = GetImageDefaultByProductId(ProductId);

            if (ProductImage != null)
            {
                return(ProductImage.Image);
            }
            ProductImage = new B2C_ECEntities().ProductImages.Where(p => p.Product_ID == ProductId).FirstOrDefault();
            if (ProductImage != null && !string.IsNullOrEmpty(ProductImage.Image))
            {
                return(ProductImage.Image);
            }
            return("no-image.png");
        }
Пример #5
0
 public int UpdateStatus(int orderID, int statusID)
 {
     try
     {
         using (var context = new B2C_ECEntities())
         {
             context.Orders.Find(orderID).OrderStatus_ID = statusID;
             return context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }