public IActionResult Put(ModelCRUD ModelCRUD) { if (ModelState.IsValid) { db.FirstOrDefault(x => x.Id == ModelCRUD.Id); return(Ok(ModelCRUD)); } return(BadRequest(ModelState)); }
public IActionResult Post(ModelCRUD ModelCRUD) { if (ModelState.IsValid) { db.Add(ModelCRUD); return(Ok(ModelCRUD)); } return(BadRequest(ModelState)); }
public IActionResult Delete(int id) { ModelCRUD ModelCRUD = db.FirstOrDefault(x => x.Id == id); if (ModelCRUD != null) { db.Remove(ModelCRUD); } return(Ok(ModelCRUD)); }
public IActionResult Put(ModelCRUD ModelCRUD) { if (ModelState.IsValid) { db.Update(ModelCRUD); db.SaveChanges(); return(Ok(ModelCRUD)); } return(BadRequest(ModelState)); }
public ModelCRUD Get(int id) { ModelCRUD ModelCRUD = db.FirstOrDefault(x => x.Id == id); return(ModelCRUD); }