public HttpResponseMessage UpsertCompanyVehicleType(string companyId, CompanyVehicleType companyVehicleType) { var company = _companyRepository.GetById(companyId); var companyVehicle = company.Vehicles.FirstOrDefault(v => v.Id == companyVehicleType.Id.ToString()); if (companyVehicle != null) { // Update existing entry companyVehicle.Name = companyVehicle.Name; companyVehicle.LogoName = companyVehicleType.LogoName; companyVehicle.ReferenceDataVehicleId = companyVehicleType.ReferenceDataVehicleId; companyVehicle.NetworkVehicleId = companyVehicleType.NetworkVehicleId; companyVehicle.MaxNumberPassengers = companyVehicleType.MaxNumberPassengers; } else { // Create new entry company.Vehicles.Add(new CompanyVehicle { Id = companyVehicleType.Id.ToString(), Name = companyVehicleType.Name, LogoName = companyVehicleType.LogoName, ReferenceDataVehicleId = companyVehicleType.ReferenceDataVehicleId, NetworkVehicleId = companyVehicleType.NetworkVehicleId, MaxNumberPassengers = companyVehicleType.MaxNumberPassengers }); } try { // Save changes _companyRepository.Update(company); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { throw new HttpException((int)HttpStatusCode.InternalServerError, ex.Message); } }
public Task UpdateMarketVehicleType(string companyId, CompanyVehicleType vehicleType) { return(Client.Post(string.Format("customer/{0}/companyVehicles", companyId), vehicleType)); }
public Task UpdateMarketVehicleType(string companyId, CompanyVehicleType vehicleType) { throw new NotImplementedException(); }