public async Task <ActionResult> adminlogin(AdminData a) { List <AdminData> admins = new List <AdminData>(); HttpClient client = _api.Initaladmin(); HttpResponseMessage res = await client.GetAsync("api/Admin"); if (res.IsSuccessStatusCode) { var results = res.Content.ReadAsStringAsync().Result; admins = JsonConvert.DeserializeObject <List <AdminData> >(results); } foreach (var item in admins) { if (item.UserName == a.UserName && item.Password == a.Password) { return(RedirectToAction("create1")); } else { _log4net.Error("invalid admin"); ViewBag.msg = "Invalid admin name or password"; } } return(View()); }