public void DeleteTag(int id) { var pictureTags = new PictureTagFindDao().GetPictureTagIdsByTagId(id); var dao = new PictureTagDeleteDao(); dao.DeleteListOfPictureTags(pictureTags); new TagDeleteDao().DeleteTag(id); }
public override TagCloudModel BuildModel() { var tags = new TagFindDao().GetAllTags(); var dao = new PictureTagFindDao(); var taglist = tags.Select(tag => new TagModel { PicturesCount = dao.GetPicturesCount(tag.TagId), Tag = tag }).ToList(); return(new TagCloudModel { TagsList = taglist }); }
public void ToEditTags(EditTagsModel model) { // распределяет по коллекциям для добавления (если объекта еще не существует) // или удаления (если объект уже существует) тэгов FirstStage(model.SelectTags); var pictureId = new PictureFindDao().GetPictureIdByPictureUrl(model.PictureUrl); var pictureTagsForPicture = new PictureTagFindDao().GetPictureTagsForPicture(pictureId); // Удаление ненужных тэгов new PictureTagDeleteDao().DeleteListOfPictureTags(GetPictureTagsForDelete(pictureTagsForPicture)); // Создание необходимых тэгов new PictureTagCreateDao().CreateTagsForPicture(pictureId, GetPictureTagsForCreate(pictureTagsForPicture)); }
private List <Picture> WithTag(int skip, int take) { var pictures = new PictureTagFindDao().GetPictureIdsByTagId(_tagId); ElementsLength = pictures.Count; if (pictures.Count == 0) { return(new List <Picture>()); } return ((from element in Table where pictures.Contains(element.PictureId) orderby element.PictureId descending select element). Skip(skip). Take(take). ToList()); }