Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("PaymentGroupId,DrawerId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] DrawerPayment drawerPayment)
        {
            if (id != drawerPayment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drawerPayment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrawerPaymentExists(drawerPayment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DrawerId"]       = new SelectList(_context.Drawers, "Id", "Name", drawerPayment.DrawerId);
            ViewData["PaymentGroupId"] = new SelectList(_context.PaymentGroups, "Id", "Class", drawerPayment.PaymentGroupId);
            return(View(_mapper.Map <DrawerPaymentViewModel>(drawerPayment)));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("PaymentGroupId,DrawerId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] DrawerPayment drawerPayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(drawerPayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DrawerId"]       = new SelectList(_context.Drawers, "Id", "Name", drawerPayment.DrawerId);
            ViewData["PaymentGroupId"] = new SelectList(_context.PaymentGroups, "Id", "Class", drawerPayment.PaymentGroupId);
            return(View(_mapper.Map <DrawerPaymentViewModel>(drawerPayment)));
        }