public IHttpActionResult PostsubCategory(SubCatVM2 subVM) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } SubCategory sub = new API_Server.SubCategory(); sub = ConvertClass.VMToSubCategory(subVM); db.SubCategories.Add(sub); db.SaveChanges(); return(Ok(sub)); }