コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Propery1,Propery2,Propery3,Propery4")] RedFish redFish)
        {
            if (id != redFish.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(redFish);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RedFishExists(redFish.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(redFish));
        }
コード例 #2
0
    static void Main()
    {
        Ground ground = new Ground();

        BlueFish   bluefish   = new BlueFish(35, 20);
        RedFish    redfish    = new RedFish(45, 38);
        YellowFish yellowfish = new YellowFish(30, 22);

        while (true)
        {
            bluefish.DrawFish();
            redfish.DrawFish();
            yellowfish.DrawFish();
            bluefish.MoveFish();
            redfish.MoveFish();
            yellowfish.MoveFish();
            Thread.Sleep(40);
        }

        while (true)
        {
            Console.Clear();

            Ceiling ceiling = new Ceiling();
            ceiling.Draw();

            Rock rock = new Rock();
            rock.Draw(50, 22);

            PauseTillNextFrame(1000);
        }
    }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Propery1,Propery2,Propery3,Propery4")] RedFish redFish)
        {
            if (ModelState.IsValid)
            {
                _context.Add(redFish);
                await _context.SaveChangesAsync();

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