public override Common.DTO.Counterparty Map(Data_Access_Layer.Counterparty entity)
        {
            var dto = base.Map(entity);

            Map(entity, dto);
            return(dto);
        }
Пример #2
0
 public virtual Common.DTO.Counterparty Map(Data_Access_Layer.Counterparty entity)
 {
     return(new Common.DTO.Counterparty
     {
         Id = entity.Id,
         Name = entity.Name,
         NIP = entity.NIP,
         PhoneNumber = entity.PhoneNumber,
         PostalCode = entity.PostalCode,
         Street = entity.Street,
         City = Map(entity.City),
         CreatedAt = entity.CreatedAt,
         LastModifiedAt = entity.LastModifiedAt
     });
 }
        public async Task UpdateCounterparty(EditCounterparty model)
        {
            var city = GetOrCreateCity(model.City);

            var entity = new Data_Access_Layer.Counterparty
            {
                Id          = model.Id,
                Name        = model.Name,
                Street      = model.Street,
                NIP         = model.NIP,
                CityId      = city.Id,
                PostalCode  = model.PostalCode,
                PhoneNumber = model.PhoneNumber
            };

            CounterpartyRepository.Update(entity);
        }
        public async Task AddCounterparty(AddCounterparty model)
        {
            await RunTaskInTransaction(async() => {
                var city = GetOrCreateCity(model.City);

                var counterparty = new Data_Access_Layer.Counterparty
                {
                    Name        = model.Name,
                    CityId      = city.Id,
                    Street      = model.PostalCode,
                    PhoneNumber = model.PhoneNumber,
                    NIP         = model.NIP
                };
                _sqliteConnection.Insert(counterparty);

                return(string.Empty);
            });
        }
        public async Task AddCounterparty(AddCounterparty model)
        {
            var city = await GetOrAddCity(model.City);

            var entity = new Data_Access_Layer.Counterparty
            {
                Name        = model.Name,
                Street      = model.Street,
                NIP         = model.NIP,
                CityId      = city.Id,
                PostalCode  = model.PostalCode,
                PhoneNumber = model.PhoneNumber
            };

            await CounterpartyRepository.Add(entity);

            Save();
        }