Exemple #1
0
        //        public List<DataAbonent> GetAbonents()
//        {
//            //var abonentList = _uow.Repository<Abonent>().GetAll()
//            //    .Select(a => new DataAbonent { TarifId = a.TarifId, Name = a.Name, AbonentId = a.AbonentId, Address = a.Address })
//            //    .ToList();
//            var abonentList = _uow.Repository<Abonent>().GetAll()
//                .Join(_uow.Repository<Tarif>().GetAll(), a => a.TarifId, t => t.TarifId, (a, t) => new { a.AbonentId, AName = a.Name, a.Address, a.TarifId, TName = t.Name })

//    .ToList();

//            return abonentList;
//        }

        public async Task <bool> AddAbonentAsync(DataAbonent dataAbonent)
        {
            var abonent = new Abonent
            {
                TarifId = dataAbonent.TarifId,
                Address = dataAbonent.Address,
                Name    = dataAbonent.Name
            };

            _uow.Repository <Abonent>().Create(abonent);
            await _uow.SaveChangesAsync();

            return(true);
        }
Exemple #2
0
 public FormNew(List <DataTarif> listDataTarifs)
 {
     _dataAbonent = new DataAbonent();
     InitializeComponent();
     _listDataTarifs = listDataTarifs;
 }