public IQueryable<Sys_Message> GetMemberMessage(int MemberID, Sys_MessageStatus MessageStatus, bool IncludeUpLevel = false) { var StatusVlaue = (int)MessageStatus; var query = DB_Service.Set<Sys_Message>().Where(x => x.MemberID == MemberID); if (IncludeUpLevel) { query = query.Where(x => x.Status >= StatusVlaue); } else { query = query.Where(x => x.Status == StatusVlaue); } return query; }
public ServiceResult ChangeMessageStatus(string Ids, Sys_MessageStatus MessageStatus) { ServiceResult result = new ServiceResult(); try { var IdsArray = Ids.Split(',').Select(x => Convert.ToInt32(x)); var StatusValue = (int)MessageStatus; DB_Service.Set<Sys_Message>().Where(x => IdsArray.Contains(x.ID)).ToList().ForEach(x => x.Status = StatusValue); DB_Service.Commit(); } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { result.AddServiceError(Utilities.GetInnerMostException(ex)); } return result; }