public void Delete(string type, int id, string createdBy) { using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext()) { WR_Focus model = db.WR_Focus.Where(p => p.Record_Status == 0 && p.Rule_ID == id && p.Created_By == createdBy).FirstOrDefault(); if (model != null) { db.WR_Focus.DeleteOnSubmit(model); db.SubmitChanges(); } } }
public void Insert(WR_Focus model) { using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext()) { bool flag = db.WR_Focus.Where(p => p.Record_Status == 0 && p.Rule_ID == model.Rule_ID && p.Created_By == model.Created_By).Any(); if (!flag) { db.WR_Focus.InsertOnSubmit(model); db.SubmitChanges(); } } }