public AProductsController(ShopDatabaseContext _db) { db = _db; aProducts.products = db.Product.ToList(); aProducts.choosenProduct = new Product() { id = 0 }; }
public AdminController(ShopDatabaseContext context) { this.db = context; this.aProducts = new AProducts() { products = db.Product.ToList(), choosenProduct = db.Product.Where(p => p.id == 0).FirstOrDefault() }; pPageInfor = new Models.Helpers.PagingInformation(aProducts.products.Count(), intialPage, pPageSize); this.aUsers = new AUsers() { customers = db.Customer.ToList(), addresses = db.Address.ToList(), comments = db.Comment.ToList(), }; this.aOrders = new AOrders() { orders = db.Order, shoppingCarts = db.ShoppingCart, items = db.Item, payments = db.Payment }; this.aAdmins = new AAdmins() { admins = db.Admin, choosenAdmin = new Models.Admin(), editedAdmin = new Models.Admin() }; uPageInfor = new Models.Helpers.PagingInformation(aUsers.customers.Count(), intialPage, uPageSize); this.aPromotion = new APromotion() { promotions = db.Promotion, choosenPromotion = new Models.Promotion(), editedPromotion = new Models.Promotion() }; this.aNews = new ANews() { news = db.News, choosenNews = new Models.News(), editedNews = new Models.News() }; }
public OrdersDetailsController(ShopDatabaseContext context) { _context = context; }
public CustomersController(ShopDatabaseContext context) { _context = context; }
public ItemsController(ShopDatabaseContext context) { _context = context; }
public CommentsController(ShopDatabaseContext context) { _context = context; }
public DataBase(ShopDatabaseContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public PromotionsController(ShopDatabaseContext context) { _context = context; }
public UserController(ShopDatabaseContext context) { this.db = context; products = db.Product.ToList(); productSizes = db.ProductSize.ToList(); images = db.Image.ToList(); if (category_filters == null || category_filters.Count() == 0) { category_filters = new List <string>(); } if (size_filters == null || size_filters.Count() == 0) { size_filters = new List <string>(); } if (price_filters == null || price_filters.Count() == 0) { price_filters = new List <int>(); } if (cart_products == null || cart_products.Count() == 0) { cart_products = new List <Product>(); } if (cart_items == null || cart_items.Count == 0) { cart_items = new List <ItemForm>(); } if (wish_products == null || wish_products.Count() == 0) { wish_products = new List <Product>(); } if (detail_products == null || detail_products.Count() == 0) { detail_products = new List <Product>(); } if (cart_images == null || cart_images.Count() == 0) { cart_images = new List <Image>(); } if (wish_images == null || wish_images.Count() == 0) { wish_images = new List <Image>(); } if (detail_images == null || detail_images.Count() == 0) { detail_images = new List <Image>(); } if (customer == null) { account = new PersonalAccountVM() { customer = new Customer() { id = 0, username = "" }, first_name = "", last_name = "", date = 1, id = 0 }; address = new PersonalAddressVM() { addresses = new List <Address>(), company_name = "", country = "", address_line_1 = "", address_line_2 = "", city = "", ZIPcode = "", mobile_phone = "", }; } else { account = new PersonalAccountVM() { customer = customer, first_name = customer.fullName.Split('_')[0], last_name = customer.fullName.Split('_')[1], id = customer.id }; address = new PersonalAddressVM() { addresses = db.Address.Where(a => a.customer == customer.id).ToList(), company_name = "", country = "", address_line_1 = "", address_line_2 = "", city = "", ZIPcode = "", mobile_phone = "", }; } if (customer != null && customer.id != 0) { checkOut = new CheckOutVM(); checkOut.last_name = customer.fullName.Split('_')[1]; checkOut.first_name = customer.fullName.Split('_')[0]; checkOut.email = customer.email; checkOut.order_items = new List <Product>(); checkOut.itemForms = new List <ItemForm>(); List <Address> adds = db.Address.Where(a => a.customer == customer.id).ToList(); if (adds.Count != 0) { Address defa = adds.Where(a => a.isDefaultAddress == true).FirstOrDefault(); if (defa == null) { defa = adds[0]; } checkOut.company_name = defa.detail.Split('_')[0]; checkOut.address_line_1 = defa.detail.Split('_')[1]; checkOut.address_line_2 = defa.detail.Split('_')[2]; checkOut.city = defa.detail.Split('_')[3]; checkOut.country = defa.detail.Split('_')[4]; checkOut.mobile_phone = defa.phone; } } else { checkOut = new CheckOutVM(); checkOut.order_items = new List <Product>(); checkOut.itemForms = new List <ItemForm>(); } if (customer == null) { customer = new Customer() { fullName = "_", id = 0, }; } if (login == null) { login = new LoginVM() { username = "", password = "", isLoggedIn = false, }; } if (catalog == null) { catalog = new CatalogProductVM(); catalog.items = new List <ItemForm>(); } initCatalog(products, productSizes, images); }
public ShoppingCartsController(ShopDatabaseContext context) { _context = context; }
public ProductsController(ShopDatabaseContext context) { _context = context; }
public AdminsController(ShopDatabaseContext context) { _context = context; }
public AddressesController(ShopDatabaseContext context) { _context = context; }