public ActionResult <ItemResponse <ScheduleAvailability> > GetByCreatedBy(int pageIndex, int pageSize)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();

                Paged <ScheduleAvailability> page = _service.GetByCreatedBy(pageIndex, pageSize, userId);

                if (page == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App Resource Not Found");
                }
                else
                {
                    response = new ItemResponse <Paged <ScheduleAvailability> > {
                        Item = page
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
예제 #2
0
        public ActionResult <ItemResponse <Paged <ScheduleAvailability> > > GetCreatedBy(int pageIndex, int pageSize, int createdBy)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                Paged <ScheduleAvailability> page = _service.GetByCreatedBy(pageIndex, pageSize, createdBy);
                if (page == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Application Resource Not Found.");
                }
                else
                {
                    response = new ItemResponse <Paged <ScheduleAvailability> > {
                        Item = page
                    };
                }
            }
            catch (Exception error)
            {
                code     = 500;
                response = new ErrorResponse(error.Message);
                base.Logger.LogError(error.ToString());
            }
            return(StatusCode(code, response));
        }