public JsonResult GetJsonByFreightType(String FreightType) { IEnumerable <CarrierAirLine> CarrierAirLineList = null; List <CarrierModel> Carrires = new List <CarrierModel>(); if (FreightModel.FreightTypes.AirFreight.ToString().Equals(FreightType)) { CarrierAirLineList = carrierService.GetAllByType(CarrierType.AirLine.ToString()); } else if (FreightModel.FreightTypes.OceanFreight.ToString().Equals(FreightType)) { CarrierAirLineList = carrierService.GetAllByType(CarrierType.ShippingLine.ToString()); } else { CarrierAirLineList = carrierService.GetQuery(); } foreach (CarrierAirLine CarrierAirLine1 in CarrierAirLineList) { CarrierModel CarrierModel1 = new CarrierModel(); CarrierModel1.Id = CarrierAirLine1.Id; CarrierModel1.Description = CarrierAirLine1.Description; CarrierModel1.CarrierAirLineName = CarrierAirLine1.CarrierAirLineName; Carrires.Add(CarrierModel1); } return(this.Json(Carrires, JsonRequestBehavior.AllowGet)); }