public static bool Create(Documents document) { using (var context = new DocumentsContext()) { context.Documents.Add(document); return context.SaveChanges() > 0; } }
public static bool Update(Documents document) { using (var context = new DocumentsContext()) { context.Documents.Attach(document); context.Entry(document).State = EntityState.Modified; return context.SaveChanges() > 0; } }
//PUT /api/products public void Put(Documents doc) { DocumentsRepository.Update(doc); }
public void Post(Documents doc) { DocumentsRepository.Create(doc); }