public async Task <IActionResult> Put(string makename, string modelname, [FromBody] ModelCarViewModel model)
        {
            try
            {
                var modelEntity = _modelRepo.GetModelByName(modelname);
                if (modelEntity == null)
                {
                    return(NotFound());
                }
                if (modelEntity.Make.Name != makename)
                {
                    return(BadRequest("there is no model for that make"));
                }

                _mapper.Map(model, modelEntity);

                if (await _modelRepo.SaveAllAsync())
                {
                    return(Ok(_mapper.Map <ModelCarViewModel>(modelEntity)));
                }
            }
            catch {}
            return(BadRequest("Could not update Model"));
        }
        public async Task <IActionResult> Post(string makename, [FromBody] ModelCarViewModel model)
        {
            try
            {
                var makeCar = _makeRepo.GetMakeCarByMoniker(makename);
                if (makeCar == null)
                {
                    return(BadRequest("There is no make"));
                }

                var modelFromBody = _mapper.Map <ModelCar>(model);
                modelFromBody.Make = makeCar;
                _modelRepo.Add(modelFromBody);
                if (await _modelRepo.SaveAllAsync())
                {
                    var url = Url.Link("GetTheModel", new { makename = makeCar.Name, modelname = modelFromBody.Name });
                    return(Created(url, _mapper.Map <ModelCarViewModel>(modelFromBody)));
                }
            }
            catch
            {
            }
            return(BadRequest("couldnt create a mdoel "));
        }