protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public static int UserNotifications(IPrincipal User, bool isAuthenticated) { if (!User.IsInRole("Administrator")) { if (!User.IsInRole("Restaurant")) { var db = new UPCLunchContext(); int nroNotificaciones = (from obj in db.Notifications where obj.Email == User.Identity.Name && obj.Seen == false select obj).Count(); db.Dispose(); return(nroNotificaciones); } } return(0); }