public T Update(T entity) { T getEntity = Get(entity.Id); _context.Attach(getEntity); getEntity = entity; //_context.Update(entity) _context.SaveChanges(); return(entity); }
internal async Task UpdateOrderAsync(Order orderResponse) { try { if (orderResponse == null) { throw new ArgumentNullException(); } Log.Information("Updating transaction."); _orderContext.Attach(orderResponse).State = EntityState.Modified; await _orderContext.SaveChangesAsync(); } catch (Exception ex) { Log.Error(ex.Message); throw; } }