Exemplo n.º 1
0
 public IActionResult Edit(GlassCalc model)
 {
     if (ModelState.IsValid)
     {
         dataManager.Glasses.SaveGlass(model);
         return(RedirectToAction(nameof(CalculatorController.Glasses), nameof(CalculatorController).CutController()));
     }
     return(View(model));
 }
 public void SaveGlass(GlassCalc entity)
 {
     if (entity.id == default)
     {
         context.Entry(entity).State = EntityState.Added;
     }
     else
     {
         context.Entry(entity).State = EntityState.Modified;
     }
     context.SaveChanges();
 }