public ActionResult Register(NewAccountModel model)
        {
            if (!ModelState.IsValid)
            {
                return View("Index", model);
            }
            var account = new Account();
            model.Update(account);
            _documentService.Save(account);

            _authCookieGenerator.SetAuthCookie(account.NameSlug);

            return RedirectToAction("Index", "Today", new {nameslug=account.NameSlug});
        }
Example #2
0
 private void CreateAccounts()
 {
     var test = new TestBase();
     _documentService.Save(test.Build.A<Account>(a => a.NameSlug = "Amory-Blaine"));
     var liam = new Account
                    {
                        FirstName = "Liam",
                        LastName = "McLennan",
                        Email = "*****@*****.**",
                        TimeZoneInfoId = "E. Australia Standard Time",
                        Password = "******"
                    };
     liam.SetNameSlug();
     _documentService.Save(liam);
 }
Example #3
0
        private void ADayWithSomeCompleteAndSomeIncompleteGoals()
        {
            account = Build.An<Account>();
            today = new CalendarDay(2010, 9, 17);
            tomorrow = new CalendarDay(2010, 9, 18);
            account.AddGoal("thing I did", today);
            account.Done(account.Goals.First(g => g.Description.Equals("thing I did")).Id);
            account.AddGoal("thing I should have done", today);
            account.AddGoal("something else I did", today);
            account.Done(account.Goals.First(g => g.Description.Equals("something else I did")).Id);
            account.AddGoal("something I forgot to do", today);
            account.AddGoal("something I will do tomorrow", tomorrow);

            var docService = Substitute.For<IDocumentService>();
            docService.Query(Arg.Any<AccountByNameSlug>()).Returns(new [] {account}.AsQueryable());
            controller = new TodayController(docService);
        }
Example #4
0
 public void Update(Account account)
 {
     Mapper.Map(this, account);
 }
Example #5
0
 public void BindTo(Account account, CalendarDay day)
 {
     Mapper.Map(account, this);
     Goals = account.GoalsFor(day);
     AccountDay = day.ToDateTime();
 }
Example #6
0
 public void BindTo(Account account)
 {
     Mapper.Map(account, this);
     AccountDay = DateTime.Now.ToUniversalTime().Add(account.TimeZone().BaseUtcOffset).Date;
     Goals = account.GoalsFor(new CalendarDay(AccountDay));
 }
Example #7
0
 private void TheGoal(string goal)
 {
     account = Build.A<Account>(a => a.Goals.Add(new Goal(goal, new CalendarDay(2010, 9, 8))));
 }
Example #8
0
 private void IAmFromChicago()
 {
     account = Build.A<Account>(); // default account is Central Standard Time (GMT -6)
 }