示例#1
0
 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));
     }
 }
示例#2
0
        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));
        }
示例#3
0
        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));
            }
        }