コード例 #1
0
ファイル: CountryController.cs プロジェクト: mn3n3/PestWeb
        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));
        }
コード例 #2
0
ファイル: CountryController.cs プロジェクト: mn3n3/PestWeb
 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));
     }
 }