コード例 #1
0
 public IActionResult UpdateOne(Fric_frac.Models.FricFrac.Country country)
 {
     if (ModelState.IsValid)
     {
         try
         {
             dbContext.Update(country);
             dbContext.SaveChanges();
             ViewBag.Countries = dbContext.Country.ToList();
             return(View("ReadingOne", country));
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!dbContext.Country.Any(e => e.Id == country.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
     }
     return(View("Index", country));
 }
コード例 #2
0
 public IActionResult InsertOne(Fric_frac.Models.FricFrac.Country Country)
 {
     ViewBag.Message = "Insert een land in de database";
     dbContext.Country.Add(Country);
     dbContext.SaveChanges();
     return(View("Index", dbContext.Country.ToList <Country>()));
 }