//int CourseId; public ActionResult SelectCardIndex(string CourseID, string CourseName) { ViewBag.CourseName = CourseName; //ViewData["CouseName"] = CourseName; TempData["CourseId"] = Int32.Parse(CourseID); TempData.Keep(); Sharing shares = new Sharing(); Repositery _repo = new Repositery(); List <Abeced_Data.Abeced.Data.AspNetUser> AllUsers = _repo.getAllAbecedUsers(); List <RegisterViewModel> users = AllUsers.Select(x => new RegisterViewModel { UserId = x.Id, UserName = x.UserName, Email = x.Email, Fname = x.Fname, Lname = x.Lname }).ToList(); shares.User = users; //IEnumerable<RegisterViewModel> AllUsersList = null; //var response = DataAccess.WebClient.GetAsync("User"); //response.Wait(); //var result = response.Result; //if (result.IsSuccessStatusCode) //{ // var readTask = result.Content.ReadAsAsync<List<RegisterViewModel>>(); // readTask.Wait(); // AllUsersList = readTask.Result; // shares.User = AllUsersList.ToList(); //} //else //{ // AllUsersList = Enumerable.Empty<RegisterViewModel>(); // ModelState.AddModelError(string.Empty, "Server Error"); //} return(View(shares)); }
public ActionResult ShareCards() { Sharing shares = new Sharing(); //IEnumerable<RegisterViewModel> AllUsersList = null; //var response = DataAccess.WebClient.GetAsync("User"); //response.Wait(); //var result = response.Result; //if (result.IsSuccessStatusCode) //{ // var readTask = result.Content.ReadAsAsync<List<RegisterViewModel>>(); // readTask.Wait(); // AllUsersList = readTask.Result; // shares.User = AllUsersList.ToList(); //} //else //{ // AllUsersList = Enumerable.Empty<RegisterViewModel>(); // ModelState.AddModelError(string.Empty, "Server Error"); //} Repositery _repo = new Repositery(); List <Abeced_Data.Abeced.Data.AspNetUser> AllUsers = _repo.getAllAbecedUsers(); List <RegisterViewModel> users = AllUsers.Select(x => new RegisterViewModel { UserId = x.Id, UserName = x.UserName, Email = x.Email, Fname = x.Fname, Lname = x.Lname }).ToList(); shares.User = users; return(PartialView(shares)); }