示例#1
0
        public JsonResult SearchVehicleByBrandName(string term)
        {
            var model = new object();

            try
            {
                model = vehicleDB.EligibilityList(new Vehicle {
                    Brand = new VehicleBrand {
                        Name = term
                    }
                })
                        .Where(s => s.BookingRemainingTime == null)
                        .Select(s => new
                {
                    value = $"{s.Plate} | {s.Brand?.Name} {s.Model?.Name} | {s.ModelYear}",
                    id    = s.Id
                }).ToList();
            }
            catch (Exception ex)
            {
                //loglama
            }

            return(Json(model));
        }
示例#2
0
        public IActionResult Index()
        {
            var model = new List <BookingViewModel>();

            try
            {
                model = vehicleDB.EligibilityList(new Vehicle {
                    IsActive = true
                })
                        .Select(s => new BookingViewModel
                {
                    Id                   = s.Id.Value,
                    Plate                = s.Plate,
                    ChassisNo            = s.ChassisNo,
                    BrandId              = s.BrandId,
                    Brand                = s.Brand,
                    VehicleModelId       = s.VehicleModelId,
                    Model                = s.Model,
                    ModelYear            = s.ModelYear,
                    VehicleTypeId        = s.VehicleTypeId,
                    VehicleType          = s.VehicleType,
                    Color                = s.Color,
                    CurrencyValue        = s.CurrencyValue,
                    Currency             = s.Currency,
                    BookingRemainingTime = s.BookingRemainingTime
                }).ToList();
            }
            catch (Exception ex)
            {
                //loglama
            }

            return(View(model));
        }