Exemplo n.º 1
0
        public ActionResult Edit(Portfolio portfolio)
        {
            portfolio.LastUpdateDate = DateTime.Today;

            if (ModelState.IsValid)
            {
                portfolio.LastUpdateDate = DateTime.Today;
                db.Entry(portfolio).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(portfolio);
        }
Exemplo n.º 2
0
        public ActionResult Create(Portfolio portfolio)
        {
            portfolio.Status = "ACTIVE";
            portfolio.StartDate = DateTime.Today;
            portfolio.LastUpdateDate = DateTime.Today;
            portfolio.Activities = new List<PortfolioEntry>();

            try
            {
                db.Portfolios.Add(portfolio);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                return View(portfolio);
            }
            
        }