コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }