public ActionResult DeleteMeeting(int id) { MeetingModel metModel = new MeetingModel(); meeting_info metInfo = metModel.GetMeeting(id); UserModel userModel = new UserModel(); user_info userInfo = userModel.GetUserInfo(User.Identity.Name); if (metInfo.mi_creator != userInfo.id && userInfo.user_grade_catg.gc_level != 9) { return(Json(new { type = 0, msg = "该会议不是您创建的,无法删除。" }, JsonRequestBehavior.AllowGet)); } try { metModel.DeleteMeeting(id); } catch (Exception ex) { return(Json(new { type = 0, msg = "删除失败:" + ex.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { type = 1, msg = "删除成功" }, JsonRequestBehavior.AllowGet)); }
public void DeleteMeeting(int userId, int id) { MeetingModel metModel = new MeetingModel(); meeting_info metInfo = metModel.GetMeeting(id); UserModel userModel = new UserModel(); user_info userInfo = userModel.GetUserInfo(userId); if (metInfo.mi_creator != userInfo.id && userInfo.user_grade_catg.gc_level != 9) { Clients.Caller.broadcastMeetingDelete(new { type = 0, msg = "该会议不是您创建的,无法删除。" }); } try { metModel.DeleteMeeting(id); } catch (Exception ex) { Clients.Caller.broadcastMeetingDelete(new { type = 0, msg = "删除失败:" + ex.Message }); } Clients.All.broadcastMeetingDelete(new { type = 1, data = new { id = id }, msg = "删除成功" }); }