예제 #1
0
        public ActionResult Edit(int id)
        {
            EmailModel blModel = EmailService.GetEmailById(id);
            if (blModel != null)
            {
                EmailEditCreateModel model = new EmailEditCreateModel
                {
                    Id = blModel.Id,
                    Subject = blModel.Subject,
                    Body = blModel.Body
                };
                return View(model);
            }

            return RedirectToAction("Index", "Emails");
        }
예제 #2
0
        public ActionResult Create(EmailEditCreateModel model)
        {
            if (ModelState.IsValid)
            {
                EmailModel blModel = new EmailModel
                {
                    Id = model.Id,
                    Subject = model.Subject,
                    Body = model.Body
                };

                EmailModel createdEmail = EmailService.CreateEmail(blModel);
                if (createdEmail != null)
                {
                    return RedirectToAction("Index", "Emails", new { id = createdEmail.Id });
                }
            }

            return View(model);
        }
예제 #3
0
 public ActionResult Create()
 {
     EmailEditCreateModel model = new EmailEditCreateModel();
     return View(model);
 }