public ActionResult DeleteRegistration([DataSourceRequest] DataSourceRequest dsRequest, Registration registration) { var reg = this.context.Registrations.Include("Courses").FirstOrDefault(r => r.Id == registration.Id); if (reg != null) { this.context.Registrations.Remove(reg); this.context.SaveChanges(); } return Json(new[] { registration }.ToDataSourceResult(dsRequest, ModelState)); }
public ActionResult EmailAccountInfo(string email) { if (string.IsNullOrEmpty(email)) { ModelState.AddModelError("email", "Please provide a valid email address."); return View("EmailAccountInfo", email); } AccountLookupResult result = new Registration().SendAccountInfo(email, Server.MapPath("/bin")); if (result == AccountLookupResult.Success) { TempData["message"] = string.Format("Account info successfully sent to {0}.", email); } else { TempData["message"] = string.Format("No account could be found by {0}.", email); } return View("EmailAccountInfo", string.Empty); }