Exemplo n.º 1
0
        public async Task <IActionResult> CreateEmail([Bind(emailProperties)] EMailAddressViewModel c)
        {
            if (!ModelState.IsValid)
            {
                return(View(c));
            }
            c.ID = Guid.NewGuid().ToString();
            var o = AddressObjectFactory.CreateEmail(c.ID, c.EmailAddress, c.ValidFrom, c.ValidTo);
            await addresses.AddObject(o);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> EditEmail([Bind(emailProperties)] EMailAddressViewModel c)
        {
            if (!ModelState.IsValid)
            {
                return(View("EditEmail", c));
            }
            var o = await addresses.GetObject(c.ID) as EmailAddressObject;

            o.DbRecord.Address   = c.EmailAddress;
            o.DbRecord.ValidFrom = c.ValidFrom ?? DateTime.MinValue;
            o.DbRecord.ValidTo   = c.ValidTo ?? DateTime.MaxValue;
            await addresses.UpdateObject(o);

            return(RedirectToAction("Index"));
        }