public ActionResult UpdatePairStarExtn(string pairName) { if (string.IsNullOrEmpty(pairName)) { return RedirectToAction("UpdatepairStar"); } var allUserDetails = GetAllUserDetails(); var pairOne = allUserDetails.FirstOrDefault(model => model.UserName.ToUpper() == pairName.ToUpper()); if (pairOne == null) return RedirectToAction("UpdatepairStar"); var pairModel = new UpdatePairModel { PairOne = pairOne, OtherUsers = allUserDetails.Except(new List<UserModel>() {pairOne}) }; return View(pairModel); }
public ActionResult UpdatePairStar(string pairName) { ViewBag.UserInfoAvailable = !string.IsNullOrEmpty(pairName); var pairModel=new UpdatePairModel(); if (!ViewBag.UserInfoAvailable) { var dataTable = Repository.GetRepository().LoadData("Select UserName from t_user"); var usernames = (from DataRow row in dataTable.Rows select row["UserName"] as string).ToList(); usernames.Insert(0,"Please select one"); ViewBag.UserNames = usernames; } else { var allUserDetails = GetAllUserDetails(); var pairOne = allUserDetails.FirstOrDefault(model => model.UserName.ToUpper() == pairName.ToUpper()); if (pairOne == null) ViewBag.UserInfoAvailable = false; pairModel.PairOne = pairOne; pairModel.OtherUsers= allUserDetails.Except(new List<UserModel>() {pairOne}); } return View(pairModel); }