Example #1
0
 public async Task <ActionResult> Edit(int id,
                                       [Bind("Id,Name,Code,Description")] IFormCollection collection,
                                       [Bind("Id,Name,Code,Description")] Education education)
 {
     if (id != education.Id)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             await educationRepo.Update(education);
         }
         catch (Exception)
         {
             if (await educationRepo.EducationExists(education.Id) == false)
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(IndexAsync)));
     }
     return(View(education));
 }
 public IActionResult Update(Education education)
 {
     _repo.Update(education);
     return(Ok());
 }