Beispiel #1
0
        public ActionResult Edit(FormCollection collection, string nome = "")
        {
            var email = new AgendaEmail
            {
                AlteradoEm  = DateTime.Now,
                AlteradoPor = Convert.ToInt32(collection["AlteradoPor"]),
                Email       = collection["Email"],
                Contato     = collection["Contato"],
                IdAgenda    = Convert.ToInt32(collection["IdAgenda"]),
                Id          = Convert.ToInt32(collection["Id"])
            };

            ViewBag.Nome = nome;
            try
            {
                if (ModelState.IsValid)
                {
                    service.Gravar(email);
                    return(RedirectToAction("Details", "Agenda", new { id = email.IdAgenda, nome = nome }));
                }

                return(View(email));
            }
            catch (ArgumentException e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
                return(View(email));
            }
        }
Beispiel #2
0
        // GET: Erp/Emails/Create
        public ActionResult Create(int idAgenda, string nome = "")
        {
            var email = new AgendaEmail {
                IdAgenda = idAgenda, AlteradoPor = login.GetIdUsuario(System.Web.HttpContext.Current.User.Identity.Name)
            };

            ViewBag.Nome = nome;
            return(View(email));
        }
Beispiel #3
0
        public void IncluirAgendaEmailTest()
        {
            // Arrange
            AgendaEmail email = new AgendaEmail
            {
                AlteradoPor = 2,
                Email       = "*****@*****.**",
                IdAgenda    = 1,
            };

            // Act
            email.Id = service.Gravar(email);

            // Assert
            Assert.IsTrue(email.Id > 0);
        }