public static void Log(string action, string desc, string relatedEntity) { using (var db = new IRContextDataContext()) { AuditTrail audit = new AuditTrail(); audit.User = HttpContext.Current.User.Identity.Name; audit.Action = action; audit.Description = desc; audit.AssociatedId = relatedEntity; audit.ActionDate = DateTime.Now; db.AuditTrails.InsertOnSubmit(audit); db.SubmitChanges(); } }
protected void btnclick_Click(object sender, EventArgs e) { IRContextDataContext db = new IRContextDataContext(); string pass = txtpass.Text; var status = (from s in db.SiteStatus where s.Id == 1 select s).FirstOrDefault(); if (pass == "pa$$word1") { status.Status = false; } else if (pass == "pa$$word2") { status.Status = true; } db.SubmitChanges(); lbl.Text = "success"; }