Beispiel #1
0
        public static UrlModel Map(iAFWebHost.Entities.Url entity)
        {
            UrlModel model = new UrlModel();
            model.Id = entity.Id;
            model.Href = entity.Href;
            model.HrefActual = entity.HrefActual;
            model.Flag = entity.Flag;
            model.Title = entity.Title;
            model.Summary = entity.Summary;
            model.UtcDate = entity.UtcDate;
            model.HttpResponseCode = entity.HttpResponseCode;
            model.HttpTimeStamp = entity.HttpTimeStamp;
            model.HttpContentLength = entity.HttpContentLength;
            model.HttpContentType = entity.HttpContentType;
            model.HttpResponseIP = entity.HttpResponseIP;

            if (entity.Users != null)
                model.Users = entity.Users;

            if (entity.Tags != null)
                model.Tags = entity.Tags;

            return model;
        }
Beispiel #2
0
        public static iAFWebHost.Entities.Url Map(UrlModel model)
        {
            iAFWebHost.Entities.Url entity = new iAFWebHost.Entities.Url();
            entity.Id = model.Id;
            entity.Href = model.Href;
            entity.HrefActual = model.HrefActual;
            entity.Flag = model.Flag;
            entity.Title = model.Title;
            entity.Summary = model.Summary;
            entity.UtcDate = model.UtcDate;
            entity.HttpTimeStamp = model.HttpTimeStamp;
            entity.HttpContentLength = model.HttpContentLength;
            entity.HttpContentType = model.HttpContentType;
            entity.HttpResponseCode = model.HttpResponseCode;
            entity.HttpResponseIP = model.HttpResponseIP;

            if (model.Users != null)
                entity.Users = model.Users;

            if (model.Tags != null)
                entity.Tags = model.Tags;

            return entity;
        }
Beispiel #3
0
        /// <summary>
        /// Resolves the URL.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        protected UrlModel ResolveUrl(string id)
        {
            UrlModel model = new UrlModel();
            Url entity = urlService.ExpandUrl(id);
            if (entity != null && entity.Href.IsValidUri())
                UrlServiceHelper.ResolveUrl(entity);

            model = Mapper.Map(entity);
            return model;
        }
Beispiel #4
0
 /// <summary>
 /// Shortens the URL.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 protected UrlModel ShortenUrl(UrlModel model)
 {
     Url entity = Mapper.Map(model);
     entity = urlService.ShortenUrl(entity);
     return Mapper.Map(entity);
 }
Beispiel #5
0
 /// <summary>
 /// Expands the URL.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 protected UrlModel ExpandUrl(string id)
 {
     UrlModel model = new UrlModel();
     Url entity = urlService.ExpandUrl(id);
     if (entity != null && !String.IsNullOrEmpty(entity.Href))
         model = Mapper.Map(entity);
     return model;
 }