public static B2C_ECEntities GetInstance() { if (_instance == null) { _instance = new B2C_ECEntities(); } return(_instance); }
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"; }
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); } }
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"); }
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); } }