Пример #1
0
        public async Task InitCar(int id)
        {
            Car = await carManager.GetCar(id);

            AllCarBrandList = (await carManager.GetAllCarBrands()).Select(b => new SelectListItem
            {
                Text     = b,
                Value    = b,
                Selected = (b == Car.Brand)
            });

            AvailableCategories = Enum.GetValues(typeof(Category)).OfType <Category>().ToList().Select(c => new SelectListItem
            {
                Text     = c.ToString(),
                Value    = c.ToString(),
                Selected = (c == Car.Category)
            });

            Locations = (await locationManager.GetAvaiableLocationsForCompany(Car.CompanyId)).Select(c => new SelectListItem
            {
                Text     = c.Country + ", " + c.City + ", " + c.Address,
                Value    = c.Id.ToString(),
                Selected = (c.Id == Car.PickUpLocationId)
            });
        }