Exemplo n.º 1
0
        public ActionResult Create(PortfolioCreationDto portfolioParams)
        {
            if (ModelState.IsValid)
            {
                var currentUser = db.UserProfiles.Single(u => u.UserName == User.Identity.Name);
                var portfolio = new Portfolio { Name = portfolioParams.Name, Owner = currentUser };
                db.Portfolios.Add(portfolio);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(portfolioParams);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Portfolio portfolio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(portfolio).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(portfolio);
 }