public ActionResult Create(string courseTermShortName, string siteShortName) { CourseTermMessage message = new CourseTermMessage(); message.Subject = string.Empty; message.Body = string.Empty; return View(message); }
public ActionResult Create(string courseTermShortName, string siteShortName, CourseTermMessage message) { if (ModelState.IsValid) { try { message.CreatedDate = DateTime.Now; message.CreatedBy = UserHelpers.GetCurrentUserID(); courseTerm.CourseTermMessages.Add(message); dataRepository.Save(); FlashMessageHelper.AddMessage("Message created successfully."); return RedirectToAction("Index", new { siteShortName = siteShortName, courseTermShortName = courseTermShortName }); } catch (RuleViolationException) { ModelState.AddModelErrors(message.GetRuleViolations()); } catch (Exception ex) { ModelState.AddModelError("_FORM", ex); } } return View(message); }