public ActionResult Index() { var userId = User.Identity.GetUserId(); var UserInfo = _unitOfWork.UserAccount.GetUserByID(userId); var AllCountry = _unitOfWork.NativeSql.GetAllCountryInfo(UserInfo.fCompanyId); var CountryFilter = new CountrySearchFilterVM { Country = AllCountry }; return(View(CountryFilter)); }
public JsonResult GetAllCountry(CountrySearchFilterVM Obj) { try { var userId = User.Identity.GetUserId(); var UserInfo = _unitOfWork.UserAccount.GetUserByID(userId); var AllCountry = _unitOfWork.NativeSql.GetAllCountryInfo(UserInfo.fCompanyId); if (AllCountry == null) { return(Json(new List <CountrySearchFilterVM>(), JsonRequestBehavior.AllowGet)); } if (Obj.CountryID != 0) { AllCountry = AllCountry.Where(m => m.CountryID == Obj.CountryID).ToList(); } return(Json(AllCountry, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ViewBag.Error = ex.Message.ToString(); return(Json(new List <CountrySearchFilterVM>(), JsonRequestBehavior.AllowGet)); } }