コード例 #1
0
        public async Task<ActionResult> Skapa(PortfolioItem portfolioItem)
        {
            if (ModelState.IsValid)
            {
                db.PortfolioItems.Add(portfolioItem.AssignValues());
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(portfolioItem);
        }
コード例 #2
0
 public async Task<ActionResult> Redigera(PortfolioItem portfolioItem)
 {
     if (ModelState.IsValid)
     {
         db.Entry(portfolioItem.AssignValues()).State = EntityState.Modified;
         await db.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(portfolioItem);
 }