public bool CheckSubscriptions(SPWorkItem workItem, SPWorkItemCollection workItems) { NewsModel listItem = newsRepo.GetSingleElementByID(workItem.ItemId); List <CategoryModel> catModel = catRepo.GetAllElements(); List <SubscriberModel> subModelList = subRepo.GetSubscriberByCategoryID(catModel); List <SingleSubscriberModel> subList = new List <SingleSubscriberModel>(); foreach (SubscriberModel item in subModelList) { subList.Add(new SingleSubscriberModel(item)); } foreach (SingleSubscriberModel submodel in subList) { List <SubscribeElementModel> subElementList = subElementRepo.GetAllElementsByUserID(submodel.UserID); SubscribeElementModel itemToAdd = new SubscribeElementModel() { UserID = workItem.UserId.ToString(), NewsID = listItem.ID, Readed = false, }; subElementRepo.AddElement(itemToAdd); } return(true); }
public SingleSubElement(SubscribeElementModel model) { UserID = model.Author; NewsID = model.NewsID; Readed = model.Readed; }