public ActionResult Index(int?projectId = null, int?taskId = null) { try { if (User.Identity.IsAuthenticated) { IMeetingLogic logic = container.Resolve <IMeetingLogic>(); IEnumerable <Meeting> viewModel = new List <Meeting>(); if (projectId == null & taskId == null) { viewModel = logic.GetAllMeetingsForCurrentUser(User.Identity.Name); } else if (taskId == null) { viewModel = logic.GetAllMeetingsForCurrentUserAndProject(User.Identity.Name, (int)projectId); } else if (projectId != null & taskId != null) { viewModel = logic.GetAllMeetingsForCurrentUserAndProjectAndTask(User.Identity.Name, (int)projectId, (int)taskId); } return(Json(new MeetingsViewModel(viewModel.ToList()), JsonRequestBehavior.AllowGet)); } return(Json(new JsonDataHandler(httpCode: HttpCodeEnum.Forbidden).getWarning(), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new JsonDataHandler(ex).getError(), JsonRequestBehavior.AllowGet)); } }
public ActionResult Edit(int projectId, int?taskId, int id) { if (User.Identity.IsAuthenticated) { IMeetingLogic logic = container.Resolve <IMeetingLogic>(); var viewmodel = new MeetingViewModel(logic.HandleMeetingGet(projectId, taskId, id)); return(Json(viewmodel, JsonRequestBehavior.AllowGet)); } return(Json(new JsonDataHandler(httpCode: HttpCodeEnum.Forbidden).getWarning(), JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Meeting meeting, int projectId, int?taskId) { try { if (User.Identity.IsAuthenticated) { IMeetingLogic logic = container.Resolve <IMeetingLogic>(); logic.HandleMeetingAdd(meeting, projectId, taskId, User.Identity.Name); return(Json(new JsonDataHandler(httpCode: HttpCodeEnum.Created, message: "Meeting successfully created!").getInfo(), JsonRequestBehavior.AllowGet)); } return(Json(new JsonDataHandler(httpCode: HttpCodeEnum.Forbidden).getWarning(), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new JsonDataHandler(ex).getError(), JsonRequestBehavior.AllowGet)); } }
public ActionResult UsersByMeeting(int meetingId) { try { if (User.Identity.IsAuthenticated) { IMeetingLogic logic = container.Resolve <IMeetingLogic>(); IEnumerable <string> usersIds = logic.GetMeetingUsers(meetingId); UsersViewModel users = getUsersQueryHelper(usersIds); return(Json(users, JsonRequestBehavior.AllowGet)); } return(Json(new JsonDataHandler(httpCode: HttpCodeEnum.Forbidden).getWarning(), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new JsonDataHandler(ex).getError(), JsonRequestBehavior.AllowGet)); } }