Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Adults,Children,ExpenseDate")] ExpectedArrival expectedArrival)
        {
            if (id != expectedArrival.AdjustId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(expectedArrival);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExpectedArrivalExists(expectedArrival.AdjustId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(expectedArrival));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Adults,Children,ExpenseDate")] ExpectedArrival expectedArrival)
        {
            if (ModelState.IsValid)
            {
                _context.Add(expectedArrival);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(expectedArrival));
        }