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. }
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. }
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. }
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; })); }