public ActionResult MeusDados(Model.UsuarioModel model) { try { if (ModelState.IsValid) { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { proxy.Update(model); } return RedirectToAction("Index"); } } catch (Exception ex) { Utils.HelperLog.WriteText(ex, "HomeController.MeusDados[POST]"); } return View(model); }
public ActionResult MeusDados(Model.UsuarioModel model) { try { if (ModelState.IsValid) { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { proxy.Update(model); } return(RedirectToAction("Index")); } } catch (Exception ex) { Utils.HelperLog.WriteText(ex, "HomeController.MeusDados[POST]"); } return(View(model)); }
public ActionResult LogOn(LoginModel model, string returnUrl) { if (ModelState.IsValid) { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { var result = proxy.Find(model.Login); if ((result != null) && (result.Length > 0)) { if (result.First().Senha.Equals(model.Senha)) { FormsService.SignIn(model.Login, false); if (!String.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "Senha incorreta."); } } else { ModelState.AddModelError("", "Usuário não encontrado."); } } } // volta para a view return(View(model)); }
public ActionResult LogOn(LoginModel model, string returnUrl) { if (ModelState.IsValid) { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { var result = proxy.Find(model.Login); if ((result != null) && (result.Length > 0)) { if (result.First().Senha.Equals(model.Senha)) { FormsService.SignIn(model.Login, false); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "Senha incorreta."); } } else { ModelState.AddModelError("", "Usuário não encontrado."); } } } // volta para a view return View(model); }
public ActionResult MeusDados() { try { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { var temp = proxy.Find(Model.SessionContextModel.UserName); if (temp.Length > 0) { return View(temp.FirstOrDefault()); } else { return RedirectToAction("Index"); } } } catch (Exception ex) { Utils.HelperLog.WriteText(ex, "HomeController.MeusDados[GET]"); return RedirectToAction("Index"); } }
public ActionResult MeusDados() { try { using (Web.UsuarioProxy.UsuarioServiceClient proxy = new Web.UsuarioProxy.UsuarioServiceClient()) { var temp = proxy.Find(Model.SessionContextModel.UserName); if (temp.Length > 0) { return(View(temp.FirstOrDefault())); } else { return(RedirectToAction("Index")); } } } catch (Exception ex) { Utils.HelperLog.WriteText(ex, "HomeController.MeusDados[GET]"); return(RedirectToAction("Index")); } }