コード例 #1
0
        public IActionResult Index(string searchingKey = null, string brandId = null)
        {
            ParameterProductsSession tempSessionParam = new ParameterProductsSession();

            tempSessionParam.searchingKey = searchingKey;
            tempSessionParam.brandId      = brandId;

            SaveSessionProductsParameter(tempSessionParam);

            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> Index(LoginFormModel input)
        {
            if (ModelState.IsValid)
            {
                HttpResponseMessage responseMessage = await HttpClientRequest.PostAsync(ApiEndpoints.Login, ConstructLoginParams(input));

                if (responseMessage.StatusCode == HttpStatusCode.OK)
                {
                    LoginModel responseModel = JsonConvert.DeserializeObject <LoginModel>(
                        await responseMessage.Content.ReadAsStringAsync());

                    if (responseModel.code == LOGIN_API_SUCCESS_CODE)
                    {
                        ParameterProductsSession productsParam = await GetParameterProductsSession();

                        SaveUserLoginSession(responseModel.data.First());

                        if (productsParam.searchingKey != null)
                        {
                            return(RedirectToAction("Index", "Home", new { area = "ProductList", searchingKey = productsParam.searchingKey }));
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Home", new { area = "" }));
                        }
                    }
                    else
                    {
                        return(HandleLoginFailAction(responseModel.code, input));
                    }
                }
                else
                {
                    return(View(input));
                }
            }
            else
            {
                return(View(input));
            }
        }