public Model CreateModel(Model model) { List <Model> models = _modelRepository.ReadAllModels(); if (model == null) { throw new ArgumentException("Model is missing"); } if (models != null) { foreach (Model m in models) { if (model.ModelId == m.ModelId && model.Name == m.Name && model.ManufacturerId == m.ManufacturerId) { throw new InvalidOperationException("Model already exist"); } } } if (_modelValidator != null) { _modelValidator.ValidateModel(model); } return(_modelRepository.AddModel(model)); }
public IActionResult AddModel([FromBody] NlpRequest <Model> request) { return(Ok(_modelrepo.AddModel(request))); }
public void AddModel(Model model) { _modelRepository.AddModel(model); }