public ActionResult Create(FormCollection collection) { try { using (var db = new DocumentDataContext()) { Document document = new Document { Title = collection["Title"].ToString(), Description = collection["Description"].ToString(), CreatedAt = DateTime.Now, UserId = db.getUserIdForUserName(User.Identity.Name) }; db.Documents.InsertOnSubmit(document); db.SubmitChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
private void detach_Documents(Document entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Documents(Document entity) { this.SendPropertyChanging(); entity.User = this; }
partial void DeleteDocument(Document instance);
partial void UpdateDocument(Document instance);
partial void InsertDocument(Document instance);
public void updateDocument(Document updatedDocument) { Document document = this.Documents.SingleOrDefault(d => d.Id == updatedDocument.Id); document.Title = updatedDocument.Title; document.Description = updatedDocument.Description; this.SubmitChanges(); }
public void insertDocument(Document document) { this.Documents.InsertOnSubmit(document); this.SubmitChanges(); }
public DocumentViewModel() { this.Documents = new List<Document>(); this.CurrentDocument = new Document(); }