public void Update(int userId, int triggerTypeId, string triggerValue, byte trgActivity) { AcTrigger trg = new AcTrigger { TrgUsrId = userId, TrgTrtId = triggerTypeId, TrgValue = triggerValue, TrgActivity = trgActivity }; _context.AcTrigger.Update(trg); _context.SaveChanges(); }
public UserTrigger getUserByTriggerType(string value, string type) { UserTrigger userTrigger = ( from trgt in _context.AcTriggerType join trg in _context.AcTrigger on new { Key1 = trgt.TrtId, Key2 = value } equals new { Key1 = trg.TrgTrtId, Key2 = trg.TrgValue } into AcTrigger from q in AcTrigger.DefaultIfEmpty() join us in _context.AcUser on q.TrgUsrId equals us.UsrId into AcUser from l in AcUser.DefaultIfEmpty() where trgt.TrtName == type select new UserTrigger { TrgtId = trgt.TrtId, UsrId = q.TrgUsrId, TrgActivity = q.TrgActivity, UsrActivity = l.UsrActivity } ).SingleOrDefault(); return(userTrigger); }