public ActionResult AlunoDias() { GraficoViewModel graficoViewModel = new GraficoViewModel(); graficoViewModel.QuantidadeDiasSl = SelectListUtils.QuantidadeDiasSl(); return(View(graficoViewModel)); }
public ActionResult Edit(int id) { AlunoViewModel alunoViewModel = new AlunoViewModel(); alunoViewModel.Aluno = _alunoService.GetById(id); alunoViewModel.CidadeSl = SelectListUtils.CidadeSl(_cidadeService.GetAll()); return(View(alunoViewModel)); }
public ActionResult Create() { AlunoViewModel alunoViewModel = new AlunoViewModel(); alunoViewModel.Aluno = new Aluno(); alunoViewModel.CidadeSl = SelectListUtils.CidadeSl(_cidadeService.GetAll()); return(View(alunoViewModel)); }
public ActionResult Create() { UsuarioViewModel usuarioViewModel = new UsuarioViewModel(); usuarioViewModel.Usuario = new Usuario(); usuarioViewModel.CidadeSl = SelectListUtils.CidadeSl(_cidadeService.GetAll()); return(View(usuarioViewModel)); }
public ActionResult Create(Usuario usuario) { try { _usuarioService.Save(usuario); return(RedirectToAction("Login")); } catch (Exception e) { UsuarioViewModel usuarioViewModel = new UsuarioViewModel(); usuarioViewModel.Usuario = new Usuario(); usuarioViewModel.CidadeSl = SelectListUtils.CidadeSl(_cidadeService.GetAll()); return(View(usuarioViewModel)); } }
public ActionResult Edit(Aluno aluno) { try { aluno.UsuarioId = UsuarioLogado.Id; _alunoService.Save(aluno); return(RedirectToAction("Index")); } catch (Exception e) { AlunoViewModel alunoViewModel = new AlunoViewModel(); alunoViewModel.Aluno = aluno; alunoViewModel.CidadeSl = SelectListUtils.CidadeSl(_cidadeService.GetAll()); return(View(alunoViewModel)); } }
public ActionResult Index(LoginModel loginModel) { ViewBag.role = new SelectList(SelectListUtils.RoleLogin(), "Value", "Text", loginModel.role); try { //login step hight agency var userAgency = db.AgencyAccounts.Single(n => n.UserName == loginModel.userName && n.IsActive == true); if (userAgency.Password == SimpleEncrypt.Encrypt(loginModel.password, true)) { Session["AccBetterLife"] = userAgency; if (loginModel.reMember == true) { #region create cookies HttpCookie ckiUser = new HttpCookie("CkBetterLife"); ckiUser["Id"] = userAgency.UserName; ckiUser["Pw"] = SimpleEncrypt.Encrypt(loginModel.password, true); ckiUser.Expires = DateTime.Now.AddDays(24); Response.Cookies.Add(ckiUser); #endregion } //redirect app #region create cookies role HttpCookie ckiRoleLogin = new HttpCookie("ckiRoleLogin"); ckiRoleLogin["ckiRoleLogin"] = "******"; ckiRoleLogin.Expires = DateTime.Now.AddDays(24); Response.Cookies.Add(ckiRoleLogin); #endregion return(Redirect("/Home")); } else { ViewBag.Message = " Sai thông tin đăng nhập"; return(View("Index")); } } //login blf account catch { try { var user = db.Staffs.Single(n => n.UserName == loginModel.userName && n.IsActive == true); if (user.Password == SimpleEncrypt.Encrypt(loginModel.password, true)) { Session["AccBetterLife"] = user; if (loginModel.reMember == true) { #region create cookies HttpCookie ckiUser = new HttpCookie("CkBetterLife"); ckiUser["Id"] = user.UserName; ckiUser["Pw"] = SimpleEncrypt.Encrypt(loginModel.password, true); ckiUser.Expires = DateTime.Now.AddDays(24); Response.Cookies.Add(ckiUser); #endregion } //redirect app #region create cookies role HttpCookie ckiRoleLogin = new HttpCookie("ckiRoleLogin"); ckiRoleLogin["ckiRoleLogin"] = "******"; ckiRoleLogin.Expires = DateTime.Now.AddDays(24); Response.Cookies.Add(ckiRoleLogin); #endregion return(Redirect("/Security/Choose")); } else { ViewBag.Message = " Sai thông tin đăng nhập"; return(View("Index")); } } catch (Exception ex) { ViewBag.Message = " Sai thông tin đăng nhập " + ex.Message; ViewBag.role = new SelectList(SelectListUtils.RoleLogin(), "Value", "Text", loginModel.role); return(View("Index")); } } }
public ActionResult Index() { ViewBag.role = new SelectList(SelectListUtils.RoleLogin(), "Value", "Text", 1); return(View()); }