Example #1
0
 public ActionResult EditDefaultStartDate(Portfolio portfolio)
 {
     try
     {
         var oldPortfolio = db.Portfolios.Find(portfolio.ID);
         oldPortfolio.DefaultStartDate = portfolio.DefaultStartDate;
         db.Entry(oldPortfolio).State = EntityState.Modified;
         db.SaveChanges();
         return Json(new { ReturnValue = 0, Message = "Default start date has been changed." });
     }
     catch (Exception e)
     {
         return Json(new { ReturnValue = -1, Message = e.Message });
     }
 }
Example #2
0
        public ActionResult Create(Portfolio portfolio)
        {
            if (ModelState.IsValid)
            {
                portfolio.DateCreated = DateTime.Now;
                portfolio.Assets = new List<Asset>();
                db.Portfolios.Add(portfolio);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(portfolio);
        }