public IActionResult Index() { _cookiesServices = new CookiesServices(HttpContext.Response.Cookies, HttpContext.Request.Cookies); if (string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nicknameCookie]) || string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nameCookie])) { return(LocalRedirect("/")); } string nickname = _cookiesServices.Get(CookiesServices.nicknameCookie); string path = HttpContext.Request.Path; DataPagePrivate dataPage = _pageDataServices.GetDataPagePrivate(nickname, path); if (!dataPage.hasPermisson) { return(LocalRedirect("/")); } ViewBag.menu = dataPage.menu; ViewBag.titleHeader = dataPage.TittleHeader; ViewBag.userName = _cookiesServices.Get(CookiesServices.nameCookie); ViewData["Title"] = dataPage.TittlePage; ViewBag.LtsUsers = _userModelServices.findAll(); ViewBag.LtsProfiles = _profileModelServices.findAll(); return(View()); }
public IActionResult UpdateCredentials() { _cookiesServices = new CookiesServices(HttpContext.Response.Cookies, HttpContext.Request.Cookies); if (string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nicknameCookie]) || string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nameCookie])) { return(LocalRedirect("/")); } ViewBag.Nickname = _cookiesServices.Get(CookiesServices.nicknameCookie); ViewBag.NameUser = _cookiesServices.Get(CookiesServices.nameCookie); return(View()); }
public IActionResult UpdateCredentials(UpdateCredentialsRequest request) { string msgValidation = _updateCredentialsServices.TryUpdate(request); /*Si el mensaje de validación es diferente de null quiere decir que hubo problemas * al actualizar las credenciales del usuario*/ if (msgValidation != null) { _cookiesServices = new CookiesServices(HttpContext.Response.Cookies, HttpContext.Request.Cookies); if (string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nicknameCookie]) || string.IsNullOrEmpty(HttpContext.Request.Cookies[CookiesServices.nameCookie])) { return(LocalRedirect("/")); } ViewBag.Nickname = _cookiesServices.Get(CookiesServices.nicknameCookie); ViewBag.NameUser = _cookiesServices.Get(CookiesServices.nameCookie); ViewBag.ErrorUpdate = msgValidation; return(View()); } return(LocalRedirect("/App/Index")); }