public ActionResult Create(Entry entry) { if (ModelState.IsValid) { db.Entries.Add(entry); db.SaveChanges(); return RedirectToAction("Index"); } return View(entry); }
public bool AddEntry(Entry newEntry) { try { newEntry.Date = DateTime.UtcNow; _ctx.Entries.Add(newEntry); return true; } catch (Exception) { //TODO log this error return false; } }
public ActionResult Edit(Entry entry) { if (ModelState.IsValid) { db.Entry(entry).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(entry); }
// // GET: /Entry/Create public ActionResult Create() { Entry entry = new Entry(); entry.Date = DateTime.Now; return View(entry); }
public bool RemoveEntry(Entry entry) { _ctx.Entries.Remove(entry); return true; }