Ejemplo n.º 1
0
        public ActionResult Index()
        {
            var userInfo = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;

            if (string.IsNullOrEmpty(userInfo))
            {
                RedirectToAction("Login", "Account");
            }

            var usuarioId = userInfo.Contains("|") ?  Int64.Parse(userInfo.Split('|').First()) : 0;

            var entity = _repositorioUsuario.Get(usuarioId);

            if (entity.Lutador != null)
            {
                var lutadorViewModel = LutadorViewModel.LutadorEntityToViewModel(entity.Lutador);

                return(View(lutadorViewModel));
            }
            else
            {
                return(RedirectToAction("CriarLutador"));
            }
        }