コード例 #1
0
        [TestMethod] public void CreateEmailTest()
        {
            var r = GetRandom.Object <EmailAddressData>();
            var o = AddressFactory.CreateEmail(r.ID, r.Address, r.ValidFrom, r.ValidTo);

            Assert.IsInstanceOfType(o, typeof(EmailAddress));
            testVariables(o.Data, r.ID, r.Address, r.ValidFrom, r.ValidTo);
        }
コード例 #2
0
        public async Task <IActionResult> CreateEmail(
            [Bind(emailProperties)] EMailAddressView c)
        {
            if (!ModelState.IsValid)
            {
                return(View(c));
            }
            c.ID = c.ID ?? Guid.NewGuid().ToString();
            var o = AddressFactory.CreateEmail(c.ID, c.EmailAddress, c.ValidFrom, c.ValidTo);
            await addresses.AddObject(o);

            return(RedirectToAction("Index"));
        }