public ActionResult <ItemsResponse <ScheduleAvailability> > GetAll()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                List <ScheduleAvailability> list = _service.GetAll();

                if (list == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App Resource not found.");
                }
                else
                {
                    response = new ItemsResponse <ScheduleAvailability> {
                        Items = list
                    };
                }
            }

            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> > > Get(int pageIndex, int pageSize)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                Paged <ScheduleAvailability> page = _service.GetAll(pageIndex, pageSize);
                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));
        }