//function to edit invoice details public void EditInvoice(int id, InvoiceMaster invoiceMaster) { tariffContext.Entry(invoiceMaster).State = EntityState.Modified; try { tariffContext.SaveChanges(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task <IActionResult> PutTariff(string id, Tariff tariff) { if (id != tariff.ServiceName) { return(BadRequest()); } _context.Entry(tariff).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TariffExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <bool> InsertAsync(Models.Tariff tariffNew) { var tariffOld = await GetCurrencTariffValueAsync(tariffNew.CompanyName, tariffNew.CategoryId); if (tariffOld != null) { tariffOld.ExpirationDate = DateTime.UtcNow; _context.Entry(tariffOld).State = EntityState.Modified; await _context.SaveChangesAsync(); } await _context.Tariffs.AddAsync(tariffNew); var inserted = await _context.SaveChangesAsync(); return(inserted > 0 ? true : false); }