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"); }
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); }
public ActionResult Create() { EmailEditCreateModel model = new EmailEditCreateModel(); return View(model); }