public async Task ToggleConfirmationAsync(Expense expense)
        {
            //Remove payment
            _context.Attach(expense).State = EntityState.Modified;

            expense.DateConfirmed =
                ((expense.DateConfirmed != null) ? (DateTime?)null : DateTime.Now);

            await _context.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task <CommandResult> Handle(RenameCategoryCommand request, CancellationToken cancellationToken)
        {
            try
            {
                var category = new Category {
                    Id = request.CategoryId
                };
                _context.Attach(category);

                _mapper.Map(request, category);

                await _context.SaveChangesAsync(cancellationToken);

                return(CommandResult.Success(request.CategoryId));
            }
            catch (Exception e)
            {
                return(CommandResult.Error(new RenameCategoryException("There was an error when trying to rename the category.", e)));
            }
        }
Ejemplo n.º 3
0
 public async Task UpdateAsync(BillInstance billInstance)
 {
     _context.Attach(billInstance).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 4
0
 public async Task UpdateBillPayAsync(BillPay billPay)
 {
     _context.Attach(billPay).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }