Ejemplo n.º 1
0
        public ActionResult Stats(string id)
        {
            if (id.IsShortCode())
            {
                // display individual url stats
                UrlModel urlModel = ExpandUrl(id);
                if (urlModel != null && !String.IsNullOrEmpty(urlModel.Href))
                {
                    UrlPageModel model = new UrlPageModel();
                    model.UrlModel          = urlModel;
                    model.HourlyDataPoints  = GetLast24HourStats(id);
                    model.DailyDataPoints   = GetLast30DaysStats(id);
                    model.MonthlyDataPoints = GetLast12MonthStats(id);
                    return(View(model));
                }
            }
            else
            {
                //display global system stats
                UrlPageModel model = new UrlPageModel();
                model.HourlyDataPoints  = GetLast24HourSystemStats();
                model.DailyDataPoints   = GetLast30DaysSystemStats();
                model.MonthlyDataPoints = GetLast12MonthSystemStats();
                return(View("SystemStats", model));
            }

            return(RedirectPermanent("/"));
        }
Ejemplo n.º 2
0
        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            UrlPageModel model = new UrlPageModel();

            return(View(model));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the requests with referrals.
        /// </summary>
        /// <returns></returns>
        protected UrlPageModel GetRequestsWithReferrals()
        {
            PageHelper       pageHelper = ParsePageHelper();
            Dto <RequestLog> dto        = requestLogService.GetRequestsWithReferrals();
            UrlPageModel     model      = Mapper.Map(dto);

            model.Pager.TempKey   = pageHelper.PreviousKey;
            model.Pager.TempKeyId = pageHelper.PreviousKeyId;
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the errors.
        /// </summary>
        /// <returns></returns>
        protected UrlPageModel GetErrors()
        {
            PageHelper   pageHelper = ParsePageHelper();
            Dto <Error>  dto        = logService.GetErrors();
            UrlPageModel model      = Mapper.Map(dto);

            model.Pager.TempKey   = pageHelper.PreviousKey;
            model.Pager.TempKeyId = pageHelper.PreviousKeyId;
            return(model);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the URL list by tag.
        /// </summary>
        /// <param name="tagName">Name of the tag.</param>
        /// <returns></returns>
        protected UrlPageModel GetUrlListByTag(string tagName)
        {
            PageHelper   pageHelper = ParsePageHelper();
            Dto <Url>    dto        = urlService.GetUrlListByTag(pageHelper.Page, pageHelper.PageSize, pageHelper.Skip, tagName, tagName, pageHelper.NextKeyId, null, pageHelper.Sort);
            UrlPageModel model      = Mapper.Map(dto);

            model.Pager.TempKey   = pageHelper.PreviousKey;
            model.Pager.TempKeyId = pageHelper.PreviousKeyId;
            model.Pager.TotalRows = urlService.GetUrlCountByTag(tagName);
            return(model);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the URL list.
        /// </summary>
        /// <returns></returns>
        protected UrlPageModel GetUrlList()
        {
            PageHelper pageHelper = ParsePageHelper();

            pageHelper.PageSize = 100;
            Dto <Url>    dto   = urlService.GetUrlList(pageHelper.Page, pageHelper.PageSize, pageHelper.Skip, pageHelper.NextKey, null, pageHelper.NextKeyId, null, pageHelper.Sort);
            UrlPageModel model = Mapper.Map(dto);

            model.Pager.TempKey   = pageHelper.PreviousKey;
            model.Pager.TempKeyId = pageHelper.PreviousKeyId;
            return(model);
        }
Ejemplo n.º 7
0
        public ActionResult Tag(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException();
            }

            UrlPageModel model = GetUrlListByTag(id);

            model.UrlCount = GetUrlCountByTag(id);
            model.Tag      = id;
            return(View(model));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Maps the specified dto.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <returns></returns>
        public static UrlPageModel Map(Dto <RequestLog> dto)
        {
            UrlPageModel           model     = new UrlPageModel();
            List <RequestLogModel> modelList = new List <RequestLogModel>();

            foreach (var entity in dto.Entities)
            {
                modelList.Add(Mapper.Map(entity));
            }
            model.Pager.Page          = dto.Page;
            model.Pager.PageSize      = dto.PageSize;
            model.Pager.TotalRows     = dto.TotalRows;
            model.Pager.PreviousKey   = dto.SKey;
            model.Pager.PreviousKeyId = dto.SId;
            model.Pager.NextKey       = dto.EKey;
            model.Pager.NextKeyId     = dto.EId;
            model.Requests            = modelList;
            return(model);
        }
Ejemplo n.º 9
0
        public ActionResult UserProfile(string username)
        {
            if (String.IsNullOrEmpty(username))
            {
                throw new ArgumentException("User name is invalid");
            }

            var user = UserManager.FindByName(username);

            if (user == null)
            {
                throw new ArgumentException("User name is invalid");
            }

            UrlPageModel model = GetUrlListByUser(username);

            model.UserName = username;
            model.UrlCount = model.Pager.TotalRows;
            return(View(model));
        }
Ejemplo n.º 10
0
        public ActionResult Ad(string id)
        {
            if (id.IsShortCode())
            {
                UrlService urlService = new UrlService();
                Url        entity     = urlService.ExpandUrl(id);
                if (entity != null && !String.IsNullOrEmpty(entity.Href))
                {
                    UrlPageModel model = new UrlPageModel();
                    model.UrlModel = Mapper.Map(entity);
                    return(View(model));
                }
                else
                {
                    throw new HttpException();
                }
            }

            return(View());
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Maps the specified dto.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <returns></returns>
        public static UrlPageModel Map(Dto <iAFWebHost.Entities.Url> dto)
        {
            UrlPageModel    model     = new UrlPageModel();
            List <UrlModel> modelList = new List <UrlModel>();

            foreach (var entity in dto.Entities)
            {
                modelList.Add(Mapper.Map(entity));
            }
            model.Pager.Page          = dto.Page;
            model.Pager.PageSize      = dto.PageSize;
            model.Pager.TotalRows     = dto.TotalRows;
            model.Pager.PreviousKey   = dto.SKey;
            model.Pager.PreviousKeyId = dto.SId;
            model.Pager.NextKey       = dto.EKey;
            model.Pager.NextKeyId     = dto.EId;
            model.Urls     = modelList;
            model.UrlCount = dto.TotalRows;
            return(model);
        }
Ejemplo n.º 12
0
        public ActionResult Trace(string id)
        {
            if (id.IsShortCode())
            {
                // display individual url stats
                UrlModel urlModel = ExpandUrl(id);

                // Attempt to resolve url on demand
                if (String.IsNullOrEmpty(urlModel.HrefActual))
                {
                    urlModel = ResolveUrl(id);
                }

                if (urlModel != null && urlModel.Href.IsValidUri())
                {
                    UrlPageModel model = new UrlPageModel();
                    model.UrlModel = urlModel;
                    return(View(model));
                }
            }

            return(RedirectPermanent("/"));
        }
Ejemplo n.º 13
0
        public ActionResult News()
        {
            UrlPageModel model = GetUrlList();

            return(View(model));
        }
Ejemplo n.º 14
0
        public ActionResult Referrals()
        {
            UrlPageModel model = GetRequestsWithReferrals();

            return(View(model));
        }
Ejemplo n.º 15
0
        public ActionResult Errors()
        {
            UrlPageModel model = GetErrors();

            return(View("Errors", model));
        }