public static string adminGiris(string kulAdi, string pass) { var result = new RepositoryLogin().KullaniciGetir(kulAdi, pass); if (result != null) { System.Web.HttpContext.Current.Session["login"] = result.logKulAdi; result.logPass = ""; return(JsonConvert.SerializeObject(new { message = "success", status = 200, data = result })); } else { return(JsonConvert.SerializeObject(new { message = "Bir hata oluştu", status = 500, data = result })); } }
public ActionResult Login(LoginClass loginClass) { if (!string.IsNullOrEmpty(Session["Username"] as string)) { return(RedirectToAction("Index", "Products")); } var repositoryLogin = RepositoryLogin.ProccessingLogin(loginClass); if (!repositoryLogin.status) { ViewBag.Message = repositoryLogin.message; return(View()); } TempData["Message"] = "Logueo Correcto"; return(RedirectToAction("Index", "Products")); }
public Tb_Usuario Logar(string usuario, string senha) { Tb_Usuario resultado = new Tb_Usuario(); StringBuilder sql = new StringBuilder(); try { sql.Append( "Select * from Tb_Usuario" + " where Nome = '" + usuario + "' and Senha = '" + senha + "'"); resultado = new RepositoryLogin().Get(sql.ToString()); } catch (Exception ex) { MessageBox.Show("Erro ao tentar efetuar o login:"******"Erro ao logar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(resultado); }
//Creamos el constructor y desde el mismo detectamos alguna exepcion en la data public LoginController(RepositoryLogin repositoryLoging) { _respositoryLogin = repositoryLoging ?? throw new ArgumentNullException(nameof(repositoryLoging)); }
public LoginViewModel() { this.repo = new RepositoryLogin(); this.usuario = new USER(); }