public ActionResult Index()
        {
            var cook = _cookieService.GetCookie(WebApp.LanguageCookieName);

            if (cook == null)
            {
                _cookieService.SetCookie(WebApp.LanguageCookieName, Thread.CurrentThread.CurrentCulture.Name);
            }
            return(View());
        }
Example #2
0
 private void VerifyCookies()
 {
     if (_cookieService.GetCookie("carrinho") == null)
     {
         throw new Exception("Carrinho está vazio");                                               // verificando se tem item no carrinho
     }
     if (_cookieService.GetCookie("cliente") == null)
     {
         throw new Exception("Nenhum cliente selecionado");                                              // verificando se têm cliente no cookie["cliente"]
     }
 }
Example #3
0
        public override Task OnConnected()
        {
            var agentTypeString = Context.QueryString["AgentType"];

            if (string.IsNullOrWhiteSpace(agentTypeString))
            {
                return(null);
            }
            {
                var fullUserName = Context.User != null ? Context.User.Identity.Name : "anonymous";
                var locale       = _cookieService.GetCookie(WebApp.LanguageCookieName);
                UserConnectionManager.Instance.ConnectUser(Context.ConnectionId, agentTypeString, fullUserName, locale);
                UserEnterOrLeave();
                Groups.Add(Context.ConnectionId, GroupName);
                return(base.OnConnected());
            }
        }
 public async Task <IActionResult> Index()
 {
     try
     {
         if (_cookieService.GetCookie("cliente") != null)
         {
             return(RedirectToAction("Registro", "Marmita")); //se ja tem cliente no cookie, direciona para compra
         }
         _cookieService.Remove("carrinho");                   // limpando cookie carrinho
         return(View(await MarmitaViewModelDB()));
     }
     catch (System.Exception e)
     {
         ModelState.AddModelError(string.Empty, e.Message);
         return(View(await MarmitaViewModelDB()));
     }
     //EnviarEmail("*****@*****.**", "Steam Authorize", MSG).GetAwaiter();
 }