예제 #1
0
        protected PageOperationResponse <T> CreatePageErrorResponse <T>(Exception ex, Guid protocol, OperationStatusType status) where T : Message.Messages.Message
        {
            PageOperationResponse <T> response = new PageOperationResponse <T>(protocol, status);

            response.Messages.Add(ex.Message);

            return(response);
        }
        public static PageOperationResponse <SubjectMessage> MapTo(PageModelResult <Subject> model)
        {
            PageOperationResponse <SubjectMessage> response = new PageOperationResponse <SubjectMessage>(model.Protocol);

            response.Messages  = model.Messages.ToList();
            response.PageCount = model.PageCount;
            response.PageIndex = model.PageIndex;
            response.RowCount  = model.RowCount;
            response.Data      = model.Data.ToList().Select(MapTo);

            return(response);
        }
예제 #3
0
        public PageOperationResponse <SubjectMessage> Read(SubjectFilter filter)
        {
            PageOperationResponse <SubjectMessage> response = null;

            try
            {
                var model = this.entityService.Read(filter);
                response = SubjectMapper.MapTo(model);
            }
            catch (Exception ex)
            {
                response = base.CreatePageErrorResponse <SubjectMessage>(ex, filter.Protocol, OperationStatusType.SystemError);
            }

            return(response);
        }