public async Task<ActionResult> Skapa(PortfolioItem portfolioItem) { if (ModelState.IsValid) { db.PortfolioItems.Add(portfolioItem.AssignValues()); await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(portfolioItem); }
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); }