예제 #1
0
        public ActionResult editAccount(int id)
        {
            if (!isLogin()) return RedirectToAction("login", "auth");
            User user = getCurrentUser();

            Provider db=new Provider();
            Account r=db.getAccount(id);
            if (user.Id != r.UserId) return View("msg", new MsgViewModel() { msg = "没有权限" });
            AccountViewModel obj = new AccountViewModel()
            {
                Id = r.Id,
                Info = r.Info,
                Money = r.Money,
                State = r.State,
                SubmitTime = r.SubmitTime,
                Time = r.Time,
                Type = r.Type,
                UserId = r.UserId,
                Tag = getTagString(db.getTagsByAccount(r.Id))
            };
            ViewData["TagCloud"] = db.getTagsByUser(user.Id);

            return View(obj);
        }
예제 #2
0
        public ActionResult detail(int id = 1)
        {
            if (!isLogin()) return RedirectToAction("login", "auth");
            User user = getCurrentUser();

            Provider db = new Provider();
            Account account = db.getAccount(id);

            if (account == null) return View("msg", new MsgViewModel() { msg = "出错了肿么办...页面不存在", url = "/" });
            if (account.UserId != user.Id) return View("msg", new MsgViewModel() { msg = "没有权限...看别人隐私的不是好孩纸" });

            return View(account);
        }