public OrderDetailDAO() { context = new OnlineShopDbContext(); }
public GetProductInOrder(OnlineShopDbContext context) { _context = context; }
public CategoryDao() { db = new OnlineShopDbContext(); }
public ContentDao() { db = new OnlineShopDbContext(); }
public BlogCommentDao() { dbContext = new OnlineShopDbContext(); }
public SlideDao() { db = new OnlineShopDbContext(); }
private static void SeedDatabase() { TestCleanUp(); var context = new OnlineShopDbContext(); var userStore = new UserStore<ApplicationUser>(context); var userManager = new ApplicationUserManager(userStore); var user = new ApplicationUser() { UserName = TestUsername, Email = TestUsername + "@gmail.com" }; var result = userManager.CreateAsync(user, TestPassword).Result; if (!result.Succeeded) { Assert.Fail(string.Join(Environment.NewLine, result.Errors)); } SeedCategories(context); SeedAdTypes(context); context.SaveChanges(); }
public CreateShoppingCart(OnlineShopDbContext context) { _context = context; }
private static void SeedAdTypes(OnlineShopDbContext context) { context.AdTypes.Add(new AdType() { Name = "Normal", Index = 100, PricePerDay = 100 }); context.AdTypes.Add(new AdType() { Name = "Gold", Index = 200, PricePerDay = 1100 }); }
private static void SeedCategories(OnlineShopDbContext context) { context.Categories.Add(new Category() { Name = "Category #1" }); context.Categories.Add(new Category() { Name = "Category #2" }); }
public void PostAd_WithOutCategories_ShouldNotAddTheAdAndReturn400BadRequest() { var context = new OnlineShopDbContext(); var adsCountBeforeInsert = context.Ads.Count(); var data = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("name", "Opel Astra"), new KeyValuePair<string, string>("description", "Astra"), new KeyValuePair<string, string>("price", "200"), new KeyValuePair<string, string>("typeid", "1"), new KeyValuePair<string, string>("categories", ""), }); var httpPostResponse = this.PostAd(data); var adsCountAfterInsert = context.Ads.Count(); // Assert Assert.AreEqual(adsCountBeforeInsert, adsCountAfterInsert); Assert.AreEqual(HttpStatusCode.BadRequest, httpPostResponse.StatusCode); }
public MenuDao() { db = new OnlineShopDbContext(); }
public UserDao() { db = new OnlineShopDbContext(); }
public FooterDao() { _context = new OnlineShopDbContext(); }
private static void TestCleanUp() { var context = new OnlineShopDbContext(); context.Ads.Delete(); context.AdTypes.Delete(); context.Categories.Delete(); context.Users.Delete(); }
public CategoryModel() { context = new OnlineShopDbContext(); }
public void PostAd_WithCorrectData_ShouldAddTheAdAndReturn200Ok() { var context = new OnlineShopDbContext(); var category = context.Categories.FirstOrDefault(); var adType = context.AdTypes.FirstOrDefault(); var adsCountBeforeInsert = context.Ads.Count(); var data = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("name", "Opel Astra"), new KeyValuePair<string, string>("description", "Astra"), new KeyValuePair<string, string>("price", "200"), new KeyValuePair<string, string>("typeid", adType.Id.ToString()), new KeyValuePair<string, string>("categories", category.Id.ToString()), }); var httpPostResponse = this.PostAd(data); var adsCountAfterInsert = context.Ads.Count(); // Assert Assert.AreEqual(adsCountBeforeInsert + 1, adsCountAfterInsert); Assert.AreEqual(HttpStatusCode.OK, httpPostResponse.StatusCode); }
public ParentIDCategoryDao() { db = new OnlineShopDbContext(); }
public ActionResult Create(CateloryViewModel collection) { try { using (OnlineShopDbContext db = new OnlineShopDbContext()) { Catelory obj = new Catelory(); obj.Prj_Name = collection.SelectedCatelory.Prj_Name; obj.Unit_Name = collection.SelectedCatelory.Unit_Name; obj.Owner_Name = collection.SelectedCatelory.Owner_Name; obj.Phone_Number = collection.SelectedCatelory.Phone_Number; obj.Person_Number = collection.SelectedCatelory.Person_Number; obj.Create_Date = DateTime.Now; obj.Status = collection.SelectedCatelory.Status; obj.Rate = collection.SelectedCatelory.Rate; obj.Job = collection.SelectedCatelory.Job; obj.Area = collection.SelectedCatelory.Area; obj.Email = collection.SelectedCatelory.Email; db.Catelories.Add(obj); db.SaveChanges(); CateloryViewModel model = new CateloryViewModel(); model.Thiet_Bi = db.Thiet_Bis.OrderBy(m => m.ID).ToList(); model.Catelory = db.Catelories.OrderBy(m => m.ID).ToList(); model.ProjectAll = new List <SelectListItem>(); var items = new List <SelectListItem>(); foreach (var project in model.Thiet_Bi) { items.Add(new SelectListItem() { Value = project.Ten_Thiet_Bi, Text = project.Ten_Thiet_Bi, }); } model.ProjectAll = items; model.SelectedCatelory = null; model.DisplayMode = null; return(RedirectToAction("Index", model)); } } catch { using (OnlineShopDbContext db = new OnlineShopDbContext()) { CateloryViewModel model = new CateloryViewModel(); model.Thiet_Bi = db.Thiet_Bis.OrderBy(m => m.ID).ToList(); model.Catelory = db.Catelories.OrderBy(m => m.ID).ToList(); model.SelectedCatelory = null; model.DisplayMode = null; return(View("Index", model)); } } }
public ProductCategoryDao() { db = new OnlineShopDbContext(); }
public AccountModel() { dbContext = new OnlineShopDbContext(); }
public ApplicationUserStore(OnlineShopDbContext context) : base(context) { }
public FooterDAO() { context = new OnlineShopDbContext(); }
public OrderDAO() { db = new OnlineShopDbContext(); }
public NhapHangDao() { db = new OnlineShopDbContext(); }
public OrderCouponDao() { db = new OnlineShopDbContext(); }
public GetAllOrders(OnlineShopDbContext context) { _context = context; }
public ProductsGroupDao() { dbContext = new OnlineShopDbContext(); }
public ThongKeDao() { db = new OnlineShopDbContext(); }
public RoleDao() { db = new OnlineShopDbContext(); }
public DiscountRequirementDao() { dbContext = new OnlineShopDbContext(); }
public PurchaseService(OnlineShopDbContext dbContext, ProductService productService) { _dbContext = dbContext; }
public ProductDao() { _context = new OnlineShopDbContext(); }
public DonHangDao() { db = new OnlineShopDbContext(); }
public GiftCardUsageHistoryDao() { dbContext = new OnlineShopDbContext(); }
public CreateProductModel(OnlineShopDbContext context, IFileManager fileManager) { _context = context; _fileManager = fileManager; }
public FooterDao() { db = new OnlineShopDbContext(); }
public UserDAO() { onlineShopDbContext = new OnlineShopDbContext(); }
public ProductDao() { db = new OnlineShopDbContext(); }