private bool EditRoute(RouteModel route) { var editWindow = new EditRouteWindow(); var ctx = (EditRouteViewModel)editWindow.DataContext; var routeCopy = new RouteModel(); CopyFields(route, routeCopy); ctx.Route = routeCopy; ctx.Airports = _airportService.GetAllAirports(); ctx.Carriers = _carrierService.GetAllCarriers(); routeCopy.AirportDepart = ctx.Airports.Single(a => a.Id == routeCopy.AirportDepart.Id); routeCopy.AirportArrive = ctx.Airports.Single(a => a.Id == routeCopy.AirportArrive.Id); if (editWindow.ShowDialog() != true) { return(false); } var errs = GetModelErrors(routeCopy); if (errs != string.Empty) { ShowError(errs, "Error! Saving cancelled. "); return(false); } CopyFields(routeCopy, route); _routeService.EditRoute(route); return(true); }
// GET: Carrier public ActionResult Index(string carrierSearchkey, string statusSearchkey = "Active") { var carriers = _carrierService.GetAllCarriers(); Enum.TryParse(statusSearchkey, out CarrierStatusEnum myStatus); carriers = _carrierService.ApplyFilterForIndex(carrierSearchkey, myStatus, carriers); return(View(carriers)); }
public IList <PolicyModel> GetAllPolicies() { var policies = new List <PolicyModel>(); var policiesData = _policyRepository.GetAll().ToList(); if (policiesData == null) { return(policies); } var carriers = _carrierService.GetAllCarriers(); var coverages = _commonService.GetAllCoverages(); var products = _commonService.GetAllProducts(); policiesData.ForEach(c => { var policy = new PolicyModel() { Id = c.Id, IsActive = (bool)c.IsActive, PolicyNumber = c.PolicyNumber, CarId = c.CarId, CoverageId = c.CoverageId, ProductId = c.ProductId, EffectiveDate = c.EffectiveDate, EndDate = c.EndDate, IsGroupInsurance = (bool)c.IsGroupInsurance, AddUser = c.AddUser, AddDate = c.AddDate, RevUser = c.RevUser, RevDate = c.RevDate }; MapSelectedCarrier(policy, carriers?.FirstOrDefault(cr => cr.Id == policy.CarId)); MapSelectedCoverage(policy, coverages?.FirstOrDefault(cov => cov.Id == policy.CoverageId)); MapSelectedProduct(policy, products?.FirstOrDefault(pro => pro.Id == policy.ProductId)); MapSelectedClient(policy); policies.Add(policy); }); return(policies); }
// GET: Commision public ActionResult Index(int?carrierId, bool?isSaved) { var commisions = new List <CommisionModel>(); try { ViewBag.Carriers = _carrierService.GetAllCarriers(); if (carrierId != null && carrierId > 0) { ViewBag.Status = CommonUtil.GetStatus(); commisions = _commisionService.GetCarrierPoliciesById(Convert.ToInt32(carrierId)); } ViewBag.PersistMessage = isSaved != null && isSaved == true ? "Commission added successfully" : ""; return(View(commisions)); } catch (Exception ex) { return(View(commisions)); } }
public ActionResult GetPatrners() { var Partners = _carrierService.GetAllCarriers().ToList(); return(Json(Partners, JsonRequestBehavior.AllowGet)); }