public void Add(IPromo promo) { if (promo != null) { _permanentPromos.Add(promo); } }
public void Remove(IPromo promo) { if (promo != null) { _permanentPromos.Remove(promo); } }
protected bool Deactivate(IPromo entity) { // Deactivate it PromosRepository.Deactivate(entity); // Try to Save Changes PromosRepository.SaveChanges(); // Finished! return(true); }
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 ; }
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); }
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> }
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 static bool AreEqual(this IPromoModel model, IPromo entity) { return(Mapper.AreEqual(model, entity)); }
public void ApplyPromo(IPromo promo) { this.ListPromo.Add(promo); }
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 static void MapToEntity(this IPromoModel model, ref IPromo entity, int currentDepth = 1) { Mapper.MapToEntity(model, ref entity, currentDepth); }
public static IPromoModel MapToModelListing(this IPromo entity, int currentDepth = 1) { return(Mapper.MapToModelListing(entity, currentDepth)); }
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); }