コード例 #1
0
        public ActionResult ExclusionTerms(TourPackageManageModel4 model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    TourPackageManageModel4 sendModel = new TourPackageManageModel4();

                    if (model.Exclusions == null)
                    {
                        sendModel.Exclusions = new List <PackageExclusions>();
                    }
                    else
                    {
                        sendModel.Exclusions = model.Exclusions.Where(x => x.IsSelected).ToList();
                    }

                    if (model.Terms == null)
                    {
                        sendModel.Terms = new List <PackageTerms>();
                    }
                    else
                    {
                        sendModel.Terms = model.Terms.Where(x => x.IsSelected).ToList();
                    }


                    if (model.Cancellations == null)
                    {
                        sendModel.Cancellations = new List <PackageCancellations>();
                    }
                    else
                    {
                        sendModel.Cancellations = model.Cancellations.Where(x => x.IsSelected).ToList();
                    }
                    sendModel.PackageID = model.Package.PackageID;

                    string jsonStr = JsonConvert.SerializeObject(sendModel);
                    string result  = objAPI.PostRecordtoApI("packageconfig", "saveexclusionterms", jsonStr);
                    if (!result.ToLower().Contains("error"))
                    {
                        TempData["ErrMsg"] = "Tour Package Details Saved";
                        return(RedirectToAction("index"));
                    }
                    TempData["ErrMsg"] = result;
                }
                model.Package = objAPI.GetObjectByKey <PackageBriefInfo>("packageconfig", "PackageBrief", model.Package.PackageID.ToString(), "id");
                return(View(model));
            }
            catch (AuthorizationException)
            {
                TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again";
                return(RedirectToAction("Login", "Account", new { Area = "" }));
            }
        }
コード例 #2
0
 public ActionResult ExclusionTerms(long id)
 {
     try
     {
         TourPackageManageModel4 model = new TourPackageManageModel4();
         model.Package       = objAPI.GetObjectByKey <PackageBriefInfo>("packageconfig", "PackageBrief", id.ToString(), "id");
         model.Exclusions    = objAPI.GetRecordsByID <PackageExclusions>("packageconfig", "packageexclusions", id);
         model.Terms         = objAPI.GetRecordsByID <PackageTerms>("packageconfig", "packageterms", id);
         model.Cancellations = objAPI.GetRecordsByID <PackageCancellations>("packageconfig", "packagecancellations", id);
         return(View(model));
     }
     catch (AuthorizationException)
     {
         TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again";
         return(RedirectToAction("Login", "Account", new { Area = "" }));
     }
 }