Пример #1
0
        public ActionResult MyAccount(MyAccountModel model, IDocumentSession session)
        {
            if (ModelState.IsValid == false)
            {
                TempData.FlashError("Whoops!", "There seems to be some problems with the information you provided. Please correct the errors and try again.");
                return View();
            }

            var account = session.Query<MyAccountModel>().FirstOrDefault();
            if (account == null)
            {
                account = new MyAccountModel();
                session.Store(account);
            }

            account.FirstName = model.FirstName;

            TempData.FlashSuccess("Your changes have been saved");

            return View("MyAccount", model);
        }
Пример #2
0
 public ActionResult MyAccount(IDocumentSession session)
 {
     var account = session.Query<MyAccountModel>().FirstOrDefault();
     if (account == null) account = new MyAccountModel();
     return View(account);
 }