コード例 #1
0
 public ImagesGridSystemLogic(LinkedList<Image> images, ImageShareDbContext cntx1, ApplicationDbContext cntx2, int columns)
 {
     ImageShareDatabase = cntx1;
     UsersDatabase = cntx2;
     Columns = columns;
     Images = new LinkedList<Image>(images);
 }
コード例 #2
0
 public ApplicationGroupManager()
 {
     _db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>();
     _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
     _roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
     _groupStore = new ApplicationGroupStore(_db);
 }
コード例 #3
0
        public void Modify(Base model, ApplicationDbContext db)
        {
            ModifyTime = DateTime.Now;
            Name = model.Name;
            Description = model.Description;

            db.Entry(this).State = EntityState.Modified;
        }
コード例 #4
0
 public virtual void Create(ApplicationDbContext db)
 {
     CreateTime = DateTime.Now;
     if (string.IsNullOrEmpty(Id))
     {
         Id = Guid.NewGuid().ToString();
     }
 }
コード例 #5
0
        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;
        }
コード例 #6
0
 public override void Create(ApplicationDbContext db)
 {
     base.Create(db);
     if (Awards != null)
     {
         foreach (var item in Awards)
         {
             db.Entry(item).State = EntityState.Unchanged;
         }
     }
 }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
 public ImageGalleryPostViewModel(){
     ApplicationDbContext db = new ApplicationDbContext();
     this.categories = db.categories.ToList();
 }
コード例 #10
0
        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);
        }
コード例 #11
0
 public BasicRepository(ApplicationDbContext db)
 {
     this.db = db;
 }
コード例 #12
0
 public void Modify(Category model, ApplicationDbContext db)
 {
     base.Modify(model,db);
 }
コード例 #13
0
 public ClaimsAdminController(ApplicationUserManager userManager, ApplicationDbContext dbContext)
 {
     DbContext = dbContext;
     UserManager = userManager;
 }
コード例 #14
0
        public ActionResult Customers()
        {
            ApplicationDbContext identityDb = new ApplicationDbContext();

            return View(identityDb.Customers.ToList());
        }
コード例 #15
0
 public AccountController()
 {
     context = new ApplicationDbContext();
 }
コード例 #16
0
 public RolesAdminController()
 {
     context = new ApplicationDbContext(); 
 }