예제 #1
0
        public async Task <LedgerAddressModel> GetLedgerAddressById(int ledgerAddressId)
        {
            LedgerAddressModel ledgerAddressModel = null;

            IList <LedgerAddressModel> ledgerAddressModelList = await GetLedgerAddressList(ledgerAddressId);

            if (null != ledgerAddressModelList && ledgerAddressModelList.Any())
            {
                ledgerAddressModel = ledgerAddressModelList.FirstOrDefault();
            }

            return(ledgerAddressModel); // returns.
        }
예제 #2
0
        public async Task <int> CreateLedgerAddress(LedgerAddressModel ledgerAddressModel)
        {
            int ledgerAddressId = 0;

            // assign values.
            Ledgeraddress ledgerAddress = new Ledgeraddress();

            ledgerAddress.LedgerId           = ledgerAddressModel.LedgerId;
            ledgerAddress.AddressDescription = ledgerAddressModel.AddressDescription;
            ledgerAddress.CountryId          = ledgerAddressModel.CountryId;
            ledgerAddress.StateId            = ledgerAddressModel.StateId;
            ledgerAddress.CityId             = ledgerAddressModel.CityId;
            ledgerAddress.EmailAddress       = ledgerAddressModel.EmailAddress;
            ledgerAddress.PhoneNo            = ledgerAddressModel.PhoneNo;
            ledgerAddress.PostalCode         = ledgerAddressModel.PostalCode;
            ledgerAddress.FaxNo = ledgerAddressModel.FaxNo;
            await Create(ledgerAddress);

            ledgerAddressId = ledgerAddress.AddressId;

            return(ledgerAddressId); // returns.
        }
예제 #3
0
        public async Task <bool> UpdateLedgerAddress(LedgerAddressModel ledgerAddressModel)
        {
            bool isUpdated = false;

            // get record.
            Ledgeraddress ledgerAddress = await GetByIdAsync(w => w.AddressId == ledgerAddressModel.AddressId);

            if (null != ledgerAddress)
            {
                // assign values.
                ledgerAddress.AddressDescription = ledgerAddressModel.AddressDescription;
                ledgerAddress.CountryId          = ledgerAddressModel.CountryId;
                ledgerAddress.StateId            = ledgerAddressModel.StateId;
                ledgerAddress.CityId             = ledgerAddressModel.CityId;
                ledgerAddress.EmailAddress       = ledgerAddressModel.EmailAddress;
                ledgerAddress.PhoneNo            = ledgerAddressModel.PhoneNo;
                ledgerAddress.PostalCode         = ledgerAddressModel.PostalCode;
                ledgerAddress.FaxNo = ledgerAddressModel.FaxNo;

                isUpdated = await Update(ledgerAddress);
            }

            return(isUpdated); // returns.
        }
예제 #4
0
        private async Task <LedgerAddressModel> AssignValueToModel(Ledgeraddress ledgerAddress)
        {
            return(await Task.Run(() =>
            {
                LedgerAddressModel ledgerAddressModel = new LedgerAddressModel();
                ledgerAddressModel.AddressId = ledgerAddress.AddressId;
                ledgerAddressModel.LedgerId = ledgerAddress.LedgerId;
                ledgerAddressModel.AddressDescription = ledgerAddress.AddressDescription;
                ledgerAddressModel.CountryId = ledgerAddress.CountryId;
                ledgerAddressModel.StateId = ledgerAddress.StateId;
                ledgerAddressModel.CityId = ledgerAddress.CityId;
                ledgerAddressModel.EmailAddress = ledgerAddress.EmailAddress;
                ledgerAddressModel.PhoneNo = ledgerAddress.PhoneNo;
                ledgerAddressModel.PostalCode = ledgerAddress.PostalCode;
                ledgerAddressModel.FaxNo = ledgerAddress.FaxNo;
                //####
                ledgerAddressModel.LedgerName = ledgerAddress.Ledger.LedgerName;
                ledgerAddressModel.CountryName = ledgerAddress.Country.CountryName;
                ledgerAddressModel.StateIName = ledgerAddress.State.StateName;
                ledgerAddressModel.CityName = ledgerAddress.City.CityName;

                return ledgerAddressModel;
            }));
        }