internal int SaveToDb() { var context = new Entities(); if (!instanceSaved) Id = GetOrCreateDbEntity(context); else updateDbEntity(context); return Id; }
public ActionResult Create(AthleteClassModel model) { try { var athleteclass = new AthleteClassModel() { Name = model.Name }; athleteclass.SaveToDb(); return RedirectToAction("Index"); } catch { return View(); } }