Ejemplo n.º 1
0
        public ResponseClass <List <ReportModel> > GetReport(RequestClass <ReportData> request)
        {
            try
            {
                if (!_repositoryGuard.IsValid(request.Login, request.Password, request.Token))
                {
                    throw new Exception("Неверные данные авторизации");
                }
                ResponseClass <List <ReportModel> > response = new ResponseClass <List <ReportModel> >();
                response.Data    = _repositoryIdentity.GetReport(request.Login, request.Data.DateFrom, request.Data.DateTo);
                response.Code    = 0;
                response.Message = "Success";
                return(response);
            }
            catch (Exception e)
            {
                ResponseClass <List <ReportModel> > response = new ResponseClass <List <ReportModel> >();
                response.Code    = -1;
                response.Message = e.Message;

                return(response);
            }
        }
Ejemplo n.º 2
0
        public ResponseClass <CabinetModel> GetCabinet(RequestClass <dynamic> request)
        {
            try
            {
                if (!_repositoryGuard.IsValid(request.Login, request.Password, request.Token))
                {
                    throw new Exception("Неверные данные авторизации");
                }

                ResponseClass <CabinetModel> response = new ResponseClass <CabinetModel>();
                response.Data    = _repositoryCabinet.GetCabinet(request.Login);
                response.Code    = 0;
                response.Message = "Success";
                return(response);
            }
            catch (Exception e)
            {
                ResponseClass <CabinetModel> response = new ResponseClass <CabinetModel>();
                response.Code    = -1;
                response.Message = e.Message;

                return(response);
            }
        }
Ejemplo n.º 3
0
        public ResponseClass <bool> ChangePassword(RequestClass <ChangeData> request)
        {
            ResponseClass <bool> model = new ResponseClass <bool>();

            try
            {
                if (!_repositoryGuard.IsValid(request.Login, request.Password, request.Token))
                {
                    throw new Exception("Неверные данные авторизации");
                }
                model.Code    = 0;
                model.Message = "Success";
                model.Data    = _repository.ChangePassword(request.Login, request.Data.NewPassword);
            }
            catch (Exception e)
            {
                model.Code    = -1;
                model.Message = e.Message;
            }
            return(model);
        }