public async Task <VoucherSetupModel> GetVoucherSetupById(int voucherSetupId) { VoucherSetupModel voucherSetupModel = null; IList <VoucherSetupModel> voucherSetupModelList = await GetVoucherSetupList(voucherSetupId); if (null != voucherSetupModelList && voucherSetupModelList.Any()) { voucherSetupModel = voucherSetupModelList.FirstOrDefault(); } return(voucherSetupModel); // returns. }
private async Task <VoucherSetupModel> AssignValueToModel(Vouchersetup voucherSetup) { return(await Task.Run(() => { VoucherSetupModel voucherSetupModel = new VoucherSetupModel(); voucherSetupModel.VoucherSetupId = voucherSetup.VoucherSetupId; voucherSetupModel.VoucherSetupName = voucherSetup.VoucherSetupName; voucherSetupModel.ModuleId = voucherSetup.ModuleId; voucherSetupModel.IsActive = voucherSetup.IsActive; voucherSetupModel.ModuleName = voucherSetup.Module.ModuleName; voucherSetupModel.PreparedByName = null != voucherSetup.PreparedByUser ? voucherSetup.PreparedByUser.UserName : null; return voucherSetupModel; })); }
public async Task <int> CreateVoucherSetup(VoucherSetupModel voucherSetupModel) { int voucherSetupId = 0; // assign values. Vouchersetup voucherSetup = new Vouchersetup(); voucherSetup.VoucherSetupName = voucherSetupModel.VoucherSetupName; voucherSetup.ModuleId = voucherSetupModel.ModuleId; voucherSetup.IsActive = voucherSetupModel.IsActive; await Create(voucherSetup); voucherSetupId = voucherSetup.VoucherSetupId; return(voucherSetupId); // returns. }
public async Task <bool> UpdateVoucherSetup(VoucherSetupModel voucherSetupModel) { bool isUpdated = false; // get record. Vouchersetup voucherSetup = await GetByIdAsync(w => w.VoucherSetupId == voucherSetupModel.VoucherSetupId); if (null != voucherSetup) { // assign values. voucherSetup.VoucherSetupName = voucherSetupModel.VoucherSetupName; voucherSetup.ModuleId = voucherSetupModel.ModuleId; voucherSetup.IsActive = voucherSetupModel.IsActive; isUpdated = await Update(voucherSetup); } return(isUpdated); // returns. }