public ActionResult Create(BinderType model) { if (!ModelState.IsValid) return View(model); BinderType.CreateBinderType(model); return RedirectToAction("Index"); }
//POST: Edit public static void EditBinderType(BinderType bt) { using (var db = new ApplicationDbContext()) { //try //{ db.Entry(bt).State = EntityState.Modified; db.SaveChanges(); //} //catch (Exception ex) when (ex is DbUpdateException || // ex is DbEntityValidationException || // ex is NotSupportedException || // ex is ObjectDisposedException || // ex is InvalidOperationException) //{ // ErrorHelpers.LogError(ex, ErrorLevel.Error, "Error on write in database"); //} } }
public static void CreateBinderType(BinderType binderType) { if (binderType != null) { using (var db = new ApplicationDbContext()) { //try //{ db.BindersTypes.Add(binderType); db.SaveChanges(); //} //catch (Exception ex) when (ex is DbUpdateException || // ex is DbEntityValidationException || // ex is NotSupportedException || // ex is ObjectDisposedException || // ex is InvalidOperationException) //{ // ErrorHelpers.LogError(ex, ErrorLevel.Error, "Error on write in database"); //} } } }