public async Task Add([FromServices] ICommonActions <Dealer> dealerSource, [FromBody] CarInfoViewModel model) { if (model == null) { return; } var dealerList = await dealerSource.GetAllAsync(); var dealer = dealerList .Where(x => x.Id == model.DealerId) .FirstOrDefault(); if (dealer == null) { return; } Car car = new Car() { Id = model.Id, CarState = model.CarState.Equals("new", StringComparison.InvariantCultureIgnoreCase) ? CarState.New : CarState.IsStock, ColorExterior = model.ColorExterior, ColorInterior = model.ColorInterior, Dealer = dealer, Name = model.Name, Price = model.Price, VinCode = model.VinCode, CarStatus = CarStatus.Active, NativeId = "None" }; await _carinfo.AddAsync(car); }
public async Task AddAsync([FromServices] ICommonActions <Country> countrySource, [FromBody] DealerInfoViewModel model) { if (model == null) { return; } var countryList = await countrySource.GetAllAsync(); var country = countryList .Where(x => x.Name.Equals(model.CountryName, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); if (country == null) { return; } Dealer dealer = new Dealer() { Id = model.Id, Name = model.Name, ContactPhone = model.ContactPhone, Status = model.Status.Equals("Active", StringComparison.InvariantCultureIgnoreCase) ? DealerStatus.Active : DealerStatus.Unknown, Street = model.Street, City = model.City, CountryState = model.CountryState, Country = country, WebSite = model.WebSite, Zip = model.Zip }; await _dealerInfo.AddAsync(dealer); }
public async Task <IActionResult> GetDealersByCarModelAsync([FromServices] ICommonActions <Car> carInfo, string name, [FromHeader] int rowCounter = 10) { var dealerList = await _dealerInfo.GetAllAsync(); var infolist = new List <DealerInfoViewModel>(); if (!string.IsNullOrEmpty(name)) { var carList = await carInfo.GetAllAsync(); var dealerIdList = carList .Where(x => x.Name.Contains(name, StringComparison.InvariantCultureIgnoreCase)) .Select(x => x.DealerId) .Distinct(); infolist.AddRange(dealerList .Where(x => dealerIdList.Contains(x.Id)) .Take(rowCounter) .Select(x => new DealerInfoViewModel() { Id = x.Id, Name = x.Name, ContactPhone = x.ContactPhone, Status = x.Status.ToString(), Street = x.Street, City = x.City, CountryState = x.CountryState, CountryName = x.Country.Name, WebSite = x.WebSite, Zip = x.Zip })); } else { infolist.AddRange(dealerList .Take(rowCounter) .Select(x => new DealerInfoViewModel() { Id = x.Id, Name = x.Name, ContactPhone = x.ContactPhone, Status = x.Status.ToString(), Street = x.Street, City = x.City, CountryState = x.CountryState, CountryName = x.Country.Name, WebSite = x.WebSite, Zip = x.Zip })); } var result = JsonConvert.SerializeObject(infolist); return(new ObjectResult(result)); }
public ScopeUploadService(IRestApiClient client, IVariablesKeeper keeper, ICommonActions <Dealer> dbDealer, ICommonActions <Country> dbCountry, ICommonActions <Car> dbCar, ICommonActions <CarHistory> dbCarHistory, ICommonActions <CarPhotoLink> dbCarPhotoLink) { _client = client; _keeper = keeper; _dbDealer = dbDealer; _dbCountry = dbCountry; _dbCarHistory = dbCarHistory; _dbCar = dbCar; _dbCarPhotoLink = dbCarPhotoLink; }
public void SetCallbacks(ICommonActions instance) { if (m_Wrapper.m_CommonActionsCallbackInterface != null) { @Inactive.started -= m_Wrapper.m_CommonActionsCallbackInterface.OnInactive; @Inactive.performed -= m_Wrapper.m_CommonActionsCallbackInterface.OnInactive; @Inactive.canceled -= m_Wrapper.m_CommonActionsCallbackInterface.OnInactive; @Talk.started -= m_Wrapper.m_CommonActionsCallbackInterface.OnTalk; @Talk.performed -= m_Wrapper.m_CommonActionsCallbackInterface.OnTalk; @Talk.canceled -= m_Wrapper.m_CommonActionsCallbackInterface.OnTalk; } m_Wrapper.m_CommonActionsCallbackInterface = instance; if (instance != null) { @Inactive.started += instance.OnInactive; @Inactive.performed += instance.OnInactive; @Inactive.canceled += instance.OnInactive; @Talk.started += instance.OnTalk; @Talk.performed += instance.OnTalk; @Talk.canceled += instance.OnTalk; } }
public void SetCallbacks(ICommonActions instance) { if (m_Wrapper.m_CommonActionsCallbackInterface != null) { @AnyKey.started -= m_Wrapper.m_CommonActionsCallbackInterface.OnAnyKey; @AnyKey.performed -= m_Wrapper.m_CommonActionsCallbackInterface.OnAnyKey; @AnyKey.canceled -= m_Wrapper.m_CommonActionsCallbackInterface.OnAnyKey; @PauseQuit.started -= m_Wrapper.m_CommonActionsCallbackInterface.OnPauseQuit; @PauseQuit.performed -= m_Wrapper.m_CommonActionsCallbackInterface.OnPauseQuit; @PauseQuit.canceled -= m_Wrapper.m_CommonActionsCallbackInterface.OnPauseQuit; } m_Wrapper.m_CommonActionsCallbackInterface = instance; if (instance != null) { @AnyKey.started += instance.OnAnyKey; @AnyKey.performed += instance.OnAnyKey; @AnyKey.canceled += instance.OnAnyKey; @PauseQuit.started += instance.OnPauseQuit; @PauseQuit.performed += instance.OnPauseQuit; @PauseQuit.canceled += instance.OnPauseQuit; } }
public CarInfoController(ICommonActions <Car> carinfo) { _carinfo = carinfo; }
public CarDealerController(ICommonActions <Dealer> source) { _source = source; }
public CountryController(ICommonActions <Country> source) { _source = source; }
public HomeController(ICommonActions <Car> carSource) { _carSource = carSource; }
public CarController(ICommonActions <Car> source) { _source = source; }
public CarHistoryController(ICommonActions <CarHistory> source) { _source = source; }
public DealerInfoController(ICommonActions <Dealer> dealerInfo) { _dealerInfo = dealerInfo; }