Ejemplo n.º 1
0
        public IHttpActionResult GetStatisticManageBasicInfor()
        {
            try
            {
                StatisticManageBasicInforDTO statistic = new StatisticManageBasicInforDTO();

                using (var db = new UserDAL())
                {
                    statistic.NumberActiveUser    = db.CountUserActiveOrNot(true);
                    statistic.NumberNotActiveUser = db.CountUserActiveOrNot(false);
                    statistic.NumberVerifyUser    = db.CountUserVerifyOrNot(true);
                    statistic.NumberNotVerifyUser = db.CountUserVerifyOrNot(false);
                    statistic.NumberNewCreateUser = db.CountNewUser();
                    statistic.NumberTotalUser     = db.CountTotalUser();

                    //Get number of event
                    statistic.NumberTotalEvent = db.CountTotalEvent();
                    //Get number of post
                    statistic.NumberTotalThread = db.CountTotalThread();
                }

                using (var db = new OrganizationDAL())
                {
                    //Get number of organization
                    statistic.NumberTotalOrganization = db.CountTotalOrganization();
                }

                return(Ok(new HTTPMessageDTO
                {
                    Status = WsConstant.HttpMessageType.SUCCESS,
                    Message = "",
                    Type = "",
                    Data = statistic
                }));
            }
            catch (Exception)
            {
                return(Ok(new HTTPMessageDTO
                {
                    Status = WsConstant.HttpMessageType.ERROR,
                    Message = "",
                    Type = ""
                }));
            }
        }