Wednesday, July 18, 2018

Return RedirectToAction in MVC using async & await

  [HttpPost]
        public async Task<ActionResult> Index(Member model)
        {


            string pass = PasswordHash.Hash(model.Password);
            var search_role = (from n in db.Members where n.UserName == model.UserName && n.Password == pass select n).ToList();
            foreach (var role in search_role)
            {

              //code here
            }



            HttpClient client = new HttpClient();
            var content = new FormUrlEncodedContent(new[]
                {
            new KeyValuePair<string, string>("n", "shimul"),
             new KeyValuePair<string, string>("em", "shimul@royex.net")
        });

            content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");

            await client.PostAsync("http://app.woopsems.com/Email/Customer-Registration.aspx", content);

     



            return RedirectToAction("Index");
        }

No comments:

Post a Comment