Ejemplo n.º 1
0
        public static PropertyAdvModel ToModel(this PropertyAdv entity)
        {
            PropertyAdvModel model = new PropertyAdvModel();

            model.Id           = entity.Id;
            model.Name         = entity.Name;
            model.Price        = entity.Price;
            model.Description  = entity.Description;
            model.PostedOn     = entity.PostedOn;
            model.ActiveTill   = entity.ActiveTill;
            model.Neighborhood = entity.Neighborhood.ToModel();
            model.PostedBy     = entity.PostedBy.ToModel();
            model.Area         = entity.Area.ToModel();
            //model.Status = entity.Status.ToModel()
            //model.Type = entity.AdvType.ToEntity();

            if (entity.Images != null)
            {
                foreach (var img in entity.Images)
                {
                    model.Images.Add(Convert.ToBase64String(img.Content));
                }
            }
            return(model);
        }
Ejemplo n.º 2
0
        public static PropertyAdv ToEntity(this PropertyAdvModel model)
        {
            PropertyAdv entity = new PropertyAdv();

            entity.Id           = model.Id;
            entity.Name         = model.Name;
            entity.Price        = model.Price;
            entity.Description  = model.Description;
            entity.PostedOn     = model.PostedOn;
            entity.ActiveTill   = model.ActiveTill;
            entity.Neighborhood = model.Neighborhood.ToEntity();
            entity.PostedBy     = model.PostedBy.ToEntity();
            entity.Status       = model.Status.ToEntity();
            entity.Type         = model.AdvType.ToEntity();
            entity.Area         = model.Area.ToEntity();
            return(entity);
        }