public async Task PutReconciliationItem(int id, ReconciliationItem ReconciliationItem) { try { await repoReconciliationItem.Update(ReconciliationItem); } catch (DbUpdateConcurrencyException) { throw; } }
private void AddToList(string completeFileName, List <ReconciliationItem> reconciliationItems) { string errorMessage = string.Empty; FileInfo file = new FileInfo(completeFileName); using (ExcelPackage package = new ExcelPackage(file)) { if (package.Workbook.Worksheets.Count == 0) { throw new Exception("Fejl ved indlæsning af excel ark. Prøv igen forfra"); } ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; int rowCount = worksheet.Dimension.Rows; int ColCount = worksheet.Dimension.Columns; for (int row = 1; row <= rowCount; row++) { errorMessage = ValidateCells(worksheet.Cells, row); if (string.IsNullOrEmpty(errorMessage) == false) { throw new Exception("Fejl i excel arket: " + errorMessage); } ReconciliationItem item = new ReconciliationItem() { BankDay = Convert.ToDateTime(worksheet.Cells[row, 1].Value.ToString()), ItemInfo = worksheet.Cells[row, 2].Value.ToString(), Amount = Convert.ToDecimal(worksheet.Cells[row, 3].Value.ToString()) }; if (row == 1) { _fromDate = item.BankDay; } if (row == rowCount) { _toDate = item.BankDay; } reconciliationItems.Add(item); } } }
public async Task PostReconciliationItem(ReconciliationItem ReconciliationItem) { await repoReconciliationItem.Add(ReconciliationItem); }