Example #1
0
 // CONSTRUCTORS
 public SingleItemViewModel(DE.Abonnement shownEntity, Enums.CrudMode crudMode)
     : base(shownEntity, crudMode)
 {
     readers = UnitOfWork.ReaderRepository.Get(orderBy: q => q.OrderBy(r => r.Name).ThenBy(r => r.Surname)).ToArray();
     books   = UnitOfWork.BookRepository
               .Get(orderBy: q => q.OrderBy(b => b.Name))
               .AsEnumerable()
               .Where(b => b.RemainsAmount > 0)
               .ToArray();
 }
Example #2
0
        // CONSTRUCTORS
        public SingleItemViewModel(DE.Book shownEntity, Enums.CrudMode crudMode)
            : base(shownEntity, crudMode)
        {
            switch (crudMode)
            {
            case Enums.CrudMode.Create: GetAllData(ShownEntity); break;

            case Enums.CrudMode.Update: GetAllData(ShownEntity); break;

            case Enums.CrudMode.Read: GetShownData(ShownEntity); break;

            default: throw new System.NotSupportedException();
            }
        }
Example #3
0
        // CONSTRUCTORS
        public SingleEntityViewModelBase(TEntity shownEntity, Enums.CrudMode crudMode)
        {
            if (crudMode == Enums.CrudMode.Create)
            {
                shownEntity = new TEntity();
            }
            if (shownEntity == null)
            {
                throw new System.ArgumentException(nameof(shownEntity));
            }

            // initialize fields
            this.shownEntity = shownEntity;
            this.crudMode    = crudMode;
            this.validationCommandFactory = new Core.Services.Factory <CV.ValidationCommandBase <TEntity> >();

            // registrate validation command
            RegistrateValidationCommand();
        }
 // CONSTRUCTORS
 public SingleItemViewModel(DE.PublishingHouse shownEntity, Enums.CrudMode crudMode)
     : base(shownEntity, crudMode)
 {
     countries = UnitOfWork.GetRepository <DE.Country>().Get(orderBy: q => q.OrderBy(c => c.Name)).ToArray();
 }