public ActionResult _Edit(int id) { var eventDirector = EventDirectorServices.GetEventDirectorById(id); if (eventDirector == null) { return(Json(new { success = false, message = "Event Director not found!" }, JsonRequestBehavior.AllowGet)); } eventDirector.ApplicationName = Applications.Single(x => x.ApplicationId == eventDirector.ApplicationId).Name; if (eventDirector == null) { return(Json(new { success = false, message = "Event Director not found!" })); } var model = new EventDirectorEditModel { EventDirectorId = eventDirector.EventDirectorId, EventId = eventDirector.EventId, EventName = eventDirector.EventName, UserEmail = eventDirector.DirectorEmail, AppId = eventDirector.ApplicationId, AppName = eventDirector.ApplicationName, Applications = Applications, IsPrimary = eventDirector.IsPrimary.GetValueOrDefault(), IsAssistant = eventDirector.IsAssistant.GetValueOrDefault() }; return(PartialView(model)); }
public ActionResult _Delete(int id) { var eventDirector = EventDirectorServices.GetEventDirectorById(id); if (eventDirector == null) { return(Json(new { success = false, message = "Event Director not found." }, JsonRequestBehavior.AllowGet)); } var deleted = EventDirectorServices.DeleteEventDirector(id); if (deleted) { return(Json(new { success = true, message = "Event Director has been deleted." }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = false, message = "Event Director could not be deleted." }, JsonRequestBehavior.AllowGet)); }