예제 #1
0
 public void Add(IPromo promo)
 {
     if (promo != null)
     {
         _permanentPromos.Add(promo);
     }
 }
예제 #2
0
 public void Remove(IPromo promo)
 {
     if (promo != null)
     {
         _permanentPromos.Remove(promo);
     }
 }
예제 #3
0
 protected bool Deactivate(IPromo entity)
 {
     // Deactivate it
     PromosRepository.Deactivate(entity);
     // Try to Save Changes
     PromosRepository.SaveChanges();
     // Finished!
     return(true);
 }
예제 #4
0
 public virtual bool AreEqual(IPromoModel model, IPromo entity)
 {
     return(NameableEntityMapper.AreEqual(model, entity)
            // Promo Properties
            && model.Link == entity.Link
            // Related Objects
            && model.PrimaryImageFileId == entity.PrimaryImageFileId &&
            model.AuthorId == entity.AuthorId &&
            model.ResourceTypeId == entity.ResourceTypeId
            );
 }
 public virtual bool AreEqual(IPromoModel model, IPromo entity)
 {
     return NameableEntityMapper.AreEqual(model, entity)
         // Promo Properties
         && model.Link == entity.Link
         // Related Objects
         && model.PrimaryImageFileId == entity.PrimaryImageFileId
         && model.AuthorId == entity.AuthorId
         && model.ResourceTypeId == entity.ResourceTypeId
         ;
 }
예제 #6
0
 protected bool Remove(IPromo entity)
 {
     if (entity == null)
     {
         return(true);
     }                                    // No entity found to remove, consider it passed
     // Remove it
     PromosRepository.Remove(entity);
     // Try to Save Changes
     PromosRepository.SaveChanges();
     // Finished!
     return(true);
 }
예제 #7
0
        public virtual IPromoModel MapToModelListing(IPromo entity, int currentDepth = 1)
        {
            currentDepth++;
            var model = NameableEntityMapper.MapToModelListing <IPromo, PromoModel>(entity);

            // Promo Properties
            model.Link = entity.Link;
            // Related Objects
            model.PrimaryImageFileId = entity.PrimaryImageFileId;
            model.AuthorId           = entity.AuthorId;
            model.ResourceTypeId     = entity.ResourceTypeId;
            // Return Entity
            return(model);
        }
 public virtual void MapToEntity(IPromoModel model, ref IPromo entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Promo Properties
     entity.Link = model.Link;
     // Related Objects
     entity.PrimaryImageFileId = model.PrimaryImageFileId;
     entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity();
     entity.AuthorId = model.AuthorId;
     entity.Author = (Person)model.Author?.MapToEntity();
     entity.ResourceTypeId = model.ResourceTypeId;
     entity.ResourceType = (ResourceType)model.ResourceType?.MapToEntity();
     // Associated Objects
     // <None>
 }
예제 #9
0
 public virtual void MapToEntity(IPromoModel model, ref IPromo entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Promo Properties
     entity.Link = model.Link;
     // Related Objects
     entity.PrimaryImageFileId = model.PrimaryImageFileId;
     entity.PrimaryImageFile   = (ImageFile)model.PrimaryImageFile?.MapToEntity();
     entity.AuthorId           = model.AuthorId;
     entity.Author             = (Person)model.Author?.MapToEntity();
     entity.ResourceTypeId     = model.ResourceTypeId;
     entity.ResourceType       = (ResourceType)model.ResourceType?.MapToEntity();
     // Associated Objects
     // <None>
 }
 public virtual IPromoModel MapToModel(IPromo entity, int currentDepth = 1)
 {
     currentDepth++;
     var model = NameableEntityMapper.MapToModel<IPromo, PromoModel>(entity);
     // Promo Properties
     model.Link = entity.Link;
     // Related Objects
     model.PrimaryImageFileId = entity.PrimaryImageFileId;
     model.PrimaryImageFile = entity.PrimaryImageFile?.MapToModel();
     model.AuthorId = entity.AuthorId;
     model.Author = entity.Author?.MapToModel();
     model.ResourceTypeId = entity.ResourceTypeId;
     model.ResourceType = entity.ResourceType?.MapToModel();
     // Associated Objects
     // <None>
     // Return Entity
     return model;
 }
 public static bool AreEqual(this IPromoModel model, IPromo entity)
 {
     return Mapper.AreEqual(model, entity);
 }
 public void Update(IPromo entity)
 {
     Context.SetModified(entity);
 }
 public void Deactivate(IPromo entity)
 {
     entity.Active = false;
     Update(entity);
 }
 public void Remove(IPromo entity)
 {
     Context.Promos.Remove((Promo)entity);
 }
 public void Add(IPromo entity)
 {
     Context.Promos.Add((Promo)entity);
 }
 public void Remove(IPromo entity)
 {
     Context.Promos.Remove((Promo)entity);
 }
예제 #17
0
 public static bool AreEqual(this IPromoModel model, IPromo entity)
 {
     return(Mapper.AreEqual(model, entity));
 }
예제 #18
0
 public void ApplyPromo(IPromo promo)
 {
     this.ListPromo.Add(promo);
 }
 public void Add(IPromo entity)
 {
     Context.Promos.Add((Promo)entity);
 }
 protected bool Remove(IPromo entity)
 {
     if (entity == null) { return true; } // No entity found to remove, consider it passed
     // Remove it
     PromosRepository.Remove(entity);
     // Try to Save Changes
     PromosRepository.SaveChanges();
     // Finished!
     return true;
 }
 protected bool Deactivate(IPromo entity)
 {
     // Deactivate it
     PromosRepository.Deactivate(entity);
     // Try to Save Changes
     PromosRepository.SaveChanges();
     // Finished!
     return true;
 }
 public void Update(IPromo entity)
 {
     Context.SetModified(entity);
 }
 public static void MapToEntity(this IPromoModel model, ref IPromo entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
예제 #24
0
 public static void MapToEntity(this IPromoModel model, ref IPromo entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
예제 #25
0
 public static IPromoModel MapToModelListing(this IPromo entity, int currentDepth = 1)
 {
     return(Mapper.MapToModelListing(entity, currentDepth));
 }
예제 #26
0
        public void UseCode(string name, ref Dictionary <Book, int> Books, ref Dictionary <string, int> discount)
        {
            IPromo code = ActivePromos[name];

            code.ApplyPromo(ref Books, ref discount);
        }
 public void Deactivate(IPromo entity)
 {
     entity.Active = false;
     Update(entity);
 }