Пример #1
0
        public ResponseModel GetTemplate()
        {
            ResponseModel        objResponseModel         = new ResponseModel();
            List <TemplateModel> objTemplateResponseModel = new List <TemplateModel>();
            int    statusCode    = 0;
            string statusMessage = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token));

                SettingsCaller newTemplate = new SettingsCaller();
                objTemplateResponseModel = newTemplate.GetTemplates(new TemplateService(Cache, Db), authenticate.TenantId);

                statusCode = objTemplateResponseModel.Count > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound;;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = objTemplateResponseModel;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }