예제 #1
0
 // Method for http post request for creating new assessory
 public async Task <IActionResult> New(Assessory ass)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (ass.AssID > 0)
             {
                 _DbContext.Update(ass);
                 await _DbContext.SaveChangesAsync();
             }
             else
             {
                 _DbContext.Add(ass);
                 await _DbContext.SaveChangesAsync();
             }
             return(RedirectToAction("Assessories"));
         }
     }
     catch (Exception)
     {
         return(RedirectToAction("Assessories"));
     }
     return(View(ass));
 }
예제 #2
0
 // default action method for new creation
 public IActionResult Create(Assessory ass)
 {
     return(View(ass));
 }