public async Task<ActionResult> Redigera( Message message) { if (ModelState.IsValid) { db.Entry(message).State = EntityState.Modified; await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(message); }
public async Task<ActionResult> Skapa(Message message) { if (ModelState.IsValid) { message.CreatedOn = DateTime.Now; db.Messages.Add(message); await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(message); }