public async Task <ActionResult> Add(VehicleModelViewModel model) { try { var result = await _modelRepo.GetModelByName(model.Description); if (result != null) { return(BadRequest("Bilmodellen existerar redan i systemet!")); } var newModel = new VehicleModel { Description = model.Description }; _modelRepo.Add(newModel); if (await _modelRepo.SaveAllAsync()) { return(StatusCode(201, newModel)); } return(StatusCode(500, "Det gick inte att spara ner ny bilmodell")); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }