예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
        }
예제 #5
0
        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");
            }
        }
예제 #6
0
        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"));
            }
        }