public ImagesGridSystemLogic(LinkedList<Image> images, ImageShareDbContext cntx1, ApplicationDbContext cntx2, int columns) { ImageShareDatabase = cntx1; UsersDatabase = cntx2; Columns = columns; Images = new LinkedList<Image>(images); }
public ApplicationGroupManager() { _db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>(); _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); _roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>(); _groupStore = new ApplicationGroupStore(_db); }
public void Modify(Base model, ApplicationDbContext db) { ModifyTime = DateTime.Now; Name = model.Name; Description = model.Description; db.Entry(this).State = EntityState.Modified; }
public virtual void Create(ApplicationDbContext db) { CreateTime = DateTime.Now; if (string.IsNullOrEmpty(Id)) { Id = Guid.NewGuid().ToString(); } }
public void Modify(Product model, ApplicationDbContext db) { base.Modify(model, db); CategoryId = model.CategoryId; Price = model.Price; ShelfLife = model.ShelfLife; CoverUrl = model.CoverUrl; Sales = model.Sales; }
public override void Create(ApplicationDbContext db) { base.Create(db); if (Awards != null) { foreach (var item in Awards) { db.Entry(item).State = EntityState.Unchanged; } } }
public ActionResult Index(int page=1) { var posts = postRepository.GetAll(); int numberPost = posts.Count(); if (numberPost == 0) { return Content("Not found anything"); } else { ApplicationDbContext db = new ApplicationDbContext(); List<Post> model = new List<Post>(); List<Post> lastestNews = new List<Post>(); List<Post> trendingPosts = new List<Post>(); Post newestPost = (from p in db.posts orderby p.createdDate descending select p).First(); //model.Add(newestPost); model = (from p in db.posts where p.isFeature == true select p).ToList(); lastestNews = (from p in db.posts orderby p.createdDate descending select p).Take(7).ToList(); trendingPosts = (from p in db.posts where p.isTrending == true orderby p.createdDate descending select p).ToList(); ViewBag.lastestNews = lastestNews; ViewBag.trendingPosts = trendingPosts; return View(model); } }
public void Modify(Activity model, ApplicationDbContext db) { base.Modify(model, db); CoverUrl = model.CoverUrl; BeginTime = model.BeginTime; EndTime = model.EndTime; Count = model.Count; model.Awards = model.Awards ?? new List<Award>(); var add = model.Awards.Where(o1 => !Awards.Any(o2 => o1.Id == o2.Id)).ToList(); var remove = Awards.Where(o1 => !model.Awards.Any(o2 => o1.Id == o2.Id)).ToList(); foreach (var item in add) { db.Entry(item).State = EntityState.Unchanged; Awards.Add(item); } foreach (var item in remove) { Awards.Remove(item); } }
public ImageGalleryPostViewModel(){ ApplicationDbContext db = new ApplicationDbContext(); this.categories = db.categories.ToList(); }
public ActionResult Products(ApplicationDbContext context,EndUsers endUsers, int? id) { var currentUser = User.Identity.Name; var LoggedInUser = db.Users.Where(u => u.Email == currentUser); //product.ProductOwnersID = LoggedInUser.ProductOwnersID; // var p = context.Products.SingleOrDefault(c => c.ProductID == id); //var e = p.EndUsers.SingleOrDefault(i => i.Email == currentUser); //if (e == null) PopulateFollowedProducts(endUsers); // p.EndUsers.Add(context.EndUsers.Single(i => i.EndUsersID == endUsers)); // var e = p.EndUsers.SingleOrDefault(i => i.Email == (e)IQueryable<ApplicationUser>LoggedInUser); // var endusersproducts = e.Products; // var e = p.EndUsers.SingleOrDefault(i => i.EndUsersID == EndUsersID); // if (e == null) // p.EndUsers.Add(context.EndUsers.Single(i => i.Name == EndUsersName)); //if (userAction == "+ Follow") //{ // ViewBag.SubmitValue = "+ Follow"; // } //if (userAction == "+ Unfollow") // { // ViewBag.SubmitValue = "+ Unfollow"; // } if (ModelState.IsValid) { EndUsers eu = new EndUsers() { EndUsersID = endUsers.EndUsersID }; db.EndUsers.Add(eu); // db.SaveChanges(); // return RedirectToAction("Index"); } return View(endUsers); }
public BasicRepository(ApplicationDbContext db) { this.db = db; }
public void Modify(Category model, ApplicationDbContext db) { base.Modify(model,db); }
public ClaimsAdminController(ApplicationUserManager userManager, ApplicationDbContext dbContext) { DbContext = dbContext; UserManager = userManager; }
public ActionResult Customers() { ApplicationDbContext identityDb = new ApplicationDbContext(); return View(identityDb.Customers.ToList()); }
public AccountController() { context = new ApplicationDbContext(); }
public RolesAdminController() { context = new ApplicationDbContext(); }