Esempio n. 1
0
        protected TRowItem CreateWorkingObject(TransferObjectBase innerObject)
        {
            var ret = new TRowItem();

            ret.InnerObject = innerObject;
            return(ret);
        }
 public void Delete(TransferObjectBase dto)
 {
     using (var locator = Begin())
     {
         var terminator = locator.Get <Terminator <TDomainEntity> >();
         terminator.Terminate(((TDtoEntity)dto).Id);
         locator.Get <IUnitOfWork>().SaveChanges();
     }
 }
 public TransferObjectBase Update(TransferObjectBase dto)
 {
     using (var locator = Begin())
     {
         var assembler    = locator.Get <AssemblerBase <TDomainEntity, TDtoEntity> >();
         var domainEntity = locator.Get <IRepository <TDomainEntity> >().Get(((TDtoEntity)dto).Id);
         assembler.FillDomainEntity(domainEntity, (TDtoEntity)dto);
         locator.Get <Publisher <TDomainEntity> >().Update(domainEntity);
         locator.Get <IUnitOfWork>().SaveChanges();
         return(assembler.ToDataTransferEntity(domainEntity));
     }
 }
 public TransferObjectBase Add(TransferObjectBase dto)
 {
     using (var locator = Begin())
     {
         var assembler    = locator.Get <AssemblerBase <TDomainEntity, TDtoEntity> >();
         var domainEntity = locator.Get <IFactory <TDomainEntity> >().CreateNew();
         assembler.FillDomainEntity(domainEntity, (TDtoEntity)dto);
         locator.Get <Publisher <TDomainEntity> >().Add(domainEntity);
         locator.Get <IUnitOfWork>().SaveChanges();
         return(assembler.ToDataTransferEntity(domainEntity));
     }
 }
Esempio n. 5
0
 public virtual void PrepareForEdit()
 {
     State.ToEdit();
     _originalItem = _dataProvider.Copy(WorkingItem.InnerObject);
 }
 public void CopyTo(TransferObjectBase source, TransferObjectBase destination)
 {
     new Copier <TDtoEntity>().Copy((TDtoEntity)source, (TDtoEntity)destination);
 }
 public TransferObjectBase Copy(TransferObjectBase dto)
 {
     return(dto.Clone());
 }
 public WorkingViewModel(TransferObjectBase innerObj)
 {
     InnerObject = innerObj;
 }