public static System.Threading.Tasks.Task <int> SaveAsync(Models.SchoolEvent schoolEvent) { using (var db = new Context.SqlContext()) { db.Entry(schoolEvent).State = schoolEvent.SchoolEventId.Equals(0) ? EntityState.Added : EntityState.Modified; return(db.SaveChangesAsync()); } }