public async Task <IActionResult> Edit(int id, [Bind("Key,KeySeller,KeyBuyer,KeyTicket,DateOfTrade")] TicketsHistory ticketsHistory)
        {
            if (id != ticketsHistory.Key)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ticketsHistory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketsHistoryExists(ticketsHistory.Key))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KeyBuyer"]  = new SelectList(_context.Users, "Key", "City", ticketsHistory.KeyBuyer);
            ViewData["KeySeller"] = new SelectList(_context.Users, "Key", "City", ticketsHistory.KeySeller);
            ViewData["KeyTicket"] = new SelectList(_context.PlainTickets, "Key", "FlightNumber", ticketsHistory.KeyTicket);
            return(View(ticketsHistory));
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Edit(int id, [Bind("Key,ComplainKey,Status,Comments")] ComplainsStatus complainsStatus)
 {
     if (ModelState.IsValid)
     {
         complainsStatus.ComplainKeyNavigation = _context.Complains.First(x => x.Key == complainsStatus.ComplainKey);
         try
         {
             _context.Update(complainsStatus);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ComplainsStatusExists(complainsStatus.Key))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["ComplainKey"] = new SelectList(_context.Complains, "Key", "Content", complainsStatus.ComplainKey);
     return(View(complainsStatus));
 }
        public async Task <IActionResult> Edit(int id, [Bind("Key,TargetKey,DateOfFlight,FlightNumber,OwnerId,CancleFee,Food,Baggage,ClassKey,Price")] PlainTickets plainTickets)
        {
            if (id != plainTickets.Key)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(plainTickets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlainTicketsExists(plainTickets.Key))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(plainTickets));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Key,Type")] Department department)
        {
            if (id != department.Key)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.Key))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }