Exemple #1
0
        public async Task <IDataAccessDataResponse> GetResponseAsync(HttpContext httpContext, XDocument xml)
        {
            uint userId = httpContext.IsAuthenicatedPr3User();

            if (userId > 0)
            {
                XElement data = xml.Element("Params");
                if (data != null)
                {
                    string category = (string)data.Element("p_category") ?? throw new DataAccessProcedureMissingData();

                    uint count = await BlockManager.CountMyBlocksAsync(userId, category);

                    return(new DataAccessCountMyBlocks2Response(category, count));
                }
                else
                {
                    throw new DataAccessProcedureMissingData();
                }
            }
            else
            {
                return(new DataAccessErrorResponse("You are not logged in!"));
            }
        }