protected virtual TEntity AddCore(ExpensesContext context, TEntity item) { BeforeAdd(context, item); item = context.Set <TEntity> ().Add(item); context.SaveChanges(); return(item); }
protected override void BeforeUpdate(ExpensesContext db, TOperation operation) { operation.UserId = m_userId; operation.CheckFields(); var dbOperation = db.Set <TOperation>().Find(operation.Id); //Operation time must stay unchanged operation.OperationTime = dbOperation.OperationTime; RollbackOperation(db, dbOperation); CommitOperation(db, operation); Cloner.Clone(operation, dbOperation); }
// GET: Expenses public async Task <IActionResult> Index() { ViewData["InteractorId"] = new SelectList(_context.Set <Interactor>(), "InteractorId", "Name"); var expensesContext = _context.Expense.Include(e => e.Interactor); return(View(await expensesContext.ToListAsync())); }