コード例 #1
0
        public ActionResult ProcessDetails(UserDetailsInput input, User user)
        {
            if (ModelState.IsValid)
            {
                using (var db = new DataContext(user))
                {
                    user.Name = input.Name;
                    user.Email = input.EmailAddress;
                    user.Twitter = input.Twitter;

                    db.SaveChanges();
                }
                return RedirectToAction("Index", "Home", new { area = "organizer" });
            }
            return View("Details");
        }
コード例 #2
0
        public void Should_map_from_entity()
        {
            var entity = new User("foo")
            {
                Email = "email",
                Id = 2,
                Twitter = "twitter",
                ImageUrl = "image url",
                Name = "name"
            };

            var input = new UserDetailsInput(entity);

            input.EmailAddress.ShouldEqual(entity.Email);
            input.Name.ShouldEqual(entity.Name);
            input.Twitter.ShouldEqual(entity.Twitter);
        }