public async Task <IActionResult> Create([Bind("Id,Model,Producer,Value,Type,PilotId")] ShuttleViewModel shuttle)
        {
            if (ModelState.IsValid)
            {
                var model = new Shuttle()
                {
                    Id       = Guid.NewGuid(),
                    Model    = shuttle.Model,
                    Pilot    = shuttle.PilotId.HasValue ? _context.Pilots.Find(shuttle.PilotId.Value) : null,
                    Producer = shuttle.Producer,
                    Type     = shuttle.Type,
                    Value    = shuttle.Value
                };

                _context.Add(model);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shuttle));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Model,Producer,Value,Type,PilotId")] ShuttleViewModel shuttle)
        {
            if (id != shuttle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var model = await _context.Shuttles.FindAsync(shuttle.Id);

                    model.Model    = shuttle.Model;
                    model.Pilot    = shuttle.PilotId.HasValue ? _context.Pilots.Find(shuttle.PilotId.Value) : null;
                    model.Producer = shuttle.Producer;
                    model.Type     = shuttle.Type;
                    model.Value    = shuttle.Value;

                    _context.Update(model);

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShuttleExists(shuttle.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shuttle));
        }