예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,year,month,sum,age0,age1,age2,age3,age4,age5,age6,age7,age8,age9,age10,age11,age12,age13,age14,age15,age16,age17,age18,age19")] PopulationAgeGroupInBaishaPenghu populationAgeGroupInBaishaPenghu)
        {
            if (id != populationAgeGroupInBaishaPenghu.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(populationAgeGroupInBaishaPenghu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PopulationAgeGroupInBaishaPenghuExists(populationAgeGroupInBaishaPenghu.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(populationAgeGroupInBaishaPenghu));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,year,month,sum,age0,age1,age2,age3,age4,age5,age6,age7,age8,age9,age10,age11,age12,age13,age14,age15,age16,age17,age18,age19")] PopulationAgeGroupInBaishaPenghu populationAgeGroupInBaishaPenghu)
        {
            if (ModelState.IsValid)
            {
                _context.Add(populationAgeGroupInBaishaPenghu);
                await _context.SaveChangesAsync();

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