public async Task <object> PostCar(AddCarToCompanyModel model) { try { await _repository.AddCar(model.Car, model.CompanyId); } catch (Exception) { return(BadRequest(new { message = "Failed to add a car." })); } return(Ok(model)); }
public async Task <object> AddCarToCompany([FromBody] AddCarToCompanyModel model) { try { await _repository.AddCarToCompany(model.Car.Id, model.CompanyId); return(Ok()); } catch (Exception e) { Console.WriteLine($"ERROR with adding car to company. -> {e.Message}"); return(new { Message = e.Message }); } }