コード例 #1
0
        public ActionResult Index(int page = 1)
        {
            var userEmail = Convert.ToString(HttpContext.Request.Cookies["Email"].Value);

            var user = Repository.Users.FirstOrDefault(p => p.Email == userEmail);
            var passwordView = new PasswordsView();
            passwordView.UserId = user.ID;
            ViewBag.ID = passwordView.UserId;
            var data = new PageableData<Passwords>(Repository.Password.OrderBy(p => p.UserID).Where(x => x.UserID == passwordView.UserId), page, 20);
            return View(data);
        }
コード例 #2
0
        public ActionResult Add(PasswordsView passwordsView)
        {
            if (ModelState.IsValid)
            {
                var userEmail = Convert.ToString(HttpContext.Request.Cookies["Email"].Value);

                var user = Repository.Users.FirstOrDefault(p => p.Email == userEmail);
                passwordsView.UserId = user.ID;

                var passwords = (Passwords)ModelMapper.Map(passwordsView, typeof(PasswordsView), typeof(Passwords));

                Repository.CreatePassword(passwords);
                return View("_OK");
            }

            return View(passwordsView);
        }
コード例 #3
0
 public ActionResult Del()
 {
     var newPasswordsView = new PasswordsView();
     return View(newPasswordsView);
 }