Esempio n. 1
0
 protected virtual TEntity AddCore(ExpensesContext context, TEntity item)
 {
     BeforeAdd(context, item);
     item = context.Set <TEntity> ().Add(item);
     context.SaveChanges();
     return(item);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        // 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()));
        }