コード例 #1
0
 public ViewResult ListToDesk(IEnumerable <Item> listItem)
 {
     ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
     ViewBag.Categories  = new MultiSelectList(db.Categories, "CategoryId", "Name");
     ViewBag.AuthorId    = new SelectList(db.Authors, "AuthorId", "Name");
     ViewBag.ItemId      = new SelectList(db.Items, "ItemId", "Name");
     return(View("Desk", listItem));
 }
コード例 #2
0
 public int ResetUserItemBag(int id, int quantity, bool add = false)
 {
     if (Support.ResetBag(db, id, quantity, HttpContext.User.Identity.Name, add: add) == 0)
     {
         return(-1);
     }
     return(Support.BillCount(db, HttpContext.User.Identity.Name));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Username,Password,Name,CreateDate,Birthday,Address,Phone,AccessId,Email")] Account account)
 {
     if (ModelState.IsValid)
     {
         db.Entry(account).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "User", new { id = account.Username }));
     }
     ViewBag.AccessId    = new SelectList(db.Accesses, "AccessId", "Name", account.AccessId);
     ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
     return(View(account));
 }
コード例 #4
0
        public ActionResult Discuss(int?page)
        {
            if (page == null)
            {
                page = 1;
            }
            var dis = (from l in db.Discusses
                       select l).OrderBy(x => x.StartDate);
            int pageSize   = 15;
            int pageNumber = (page ?? 1);

            ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
            return(View(dis.ToPagedList(pageNumber, pageSize)));
        }
コード例 #5
0
        public ActionResult News(int?page)
        {
            if (page == null)
            {
                page = 1;
            }
            var news = (from l in db.News.Include(a => a.Discuss).Include(a => a.Account).Where(x => x.isPublic == true)
                        select l).OrderBy(x => x.Username);
            int pageSize   = 1;
            int pageNumber = (page ?? 1);

            ViewBag.Type        = "none";
            ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
            return(View(news.ToPagedList(pageNumber, pageSize)));
        }
コード例 #6
0
        // GET: User/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Account account = db.Accounts.Find(id);

            if (account == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
            return(View(account));
        }
コード例 #7
0
        // GET: User/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Account account = db.Accounts.Find(id);

            if (account == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AccessId    = new SelectList(db.Accesses, "AccessId", "Name", account.AccessId);
            ViewBag.UserBagItem = Support.BillCount(db, HttpContext.User.Identity.Name);
            return(View(account));
        }