Beispiel #1
0
        public async Task <IActionResult> Create(ApoioEscolar apoioEscolar)
        {
            if (ModelState.IsValid)
            {
                _context.Add(apoioEscolar);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(apoioEscolar));
        }
Beispiel #2
0
 public async Task <IActionResult> Edit(ApoioEscolar apoioEscolar)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(apoioEscolar);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ApoioEscolarExists(apoioEscolar.Codigo))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(apoioEscolar));
 }