public ActionResult Update(Account account) { if (ModelState.IsValid) { repository.Save(account); return RedirectToAction("Show", account.Id); } return View("Edit", account); }
public void Find_ShouldFindTheRecordById() { var original = new Account(); repository.Save(original); session.Clear(); var record = repository.Find<Account>(1); Assert.IsTrue(record.Equals(original)); }
public void FindAll_ShouldFindRecordsByCriteria() { var original = new Account(); repository.Save(original); session.Clear(); var record = repository.FindAll<Account>(x => x.Id == 1); Assert.IsTrue(record[0].Equals(original)); }
public ActionResult Create(Account account) { if (ModelState.IsValid) { repository.Save(account); return RedirectToAction("Index"); } return RedirectToAction("New"); }
public void ShouldPersistPosts() { var account = new Account { Email = "email" }; new PersistenceSpecification<Post>(session) .CheckProperty(c => c.Title, "title") .CheckProperty(c => c.Body, "body") //.CheckProperty(c => c.Author, account) .VerifyTheMappings(); }
public Account Create(string email, string password) { var salt = GenerateSalt(); var user = new Account { Email = email, EncryptedPassword = GenerateSaltedPassword(password, salt), PasswordSalt = salt }; repository.Save(user); return user; }