Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ExpenseTypeName,Comment")] TypeOfExpense typeOfExpense)
        {
            if (id != typeOfExpense.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeOfExpense);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeOfExpenseExists(typeOfExpense.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfExpense));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,ExpenseTypeName,Comment")] TypeOfExpense typeOfExpense)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeOfExpense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfExpense));
        }
Exemplo n.º 3
0
 public override string ToString()
 {
     return(string.Format("{0},{1},{2},{3},{4},{5}", TypeOfExpense.ToString(), Amount.ToString(), Comment.ToString(), Period.ToString(), WayOfPayment.ToString(), Date.ToString()));
 }