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); }
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); }
public ActionResult Del() { var newPasswordsView = new PasswordsView(); return View(newPasswordsView); }