public void CheckMarkRemoved(List <Mark> listMark, Guid idObjective)
        {
            var oldList = _repository.GetAllByObjective(idObjective);

            foreach (var mark in oldList)
            {
                if (!listMark.Contains(mark))
                {
                    _repository.Delete(mark);
                }
            }
        }
Esempio n. 2
0
        public Mark AddMark(MarkModel model, string login)
        {
            var comments = _commentsRepository.Find(x => x.ProductId == model.ProductId).FirstOrDefault();

            if (comments == null)
            {
                comments = new Comments
                {
                    Id          = ObjectId.GenerateNewId(),
                    CommentList = new List <Comment>(),
                    ProductId   = model.ProductId,
                    MarkList    = new List <Mark>()
                };

                _commentsRepository.Add(comments);
            }

            if (comments.MarkList == null)
            {
                comments.MarkList = new List <Mark>();
            }

            var oldMark = comments.MarkList.FirstOrDefault(x => x.UserId == login);

            if (oldMark != null)
            {
                _markRepository.Delete(oldMark.Id);
            }

            var newMark = new Mark
            {
                Id          = ObjectId.GenerateNewId(DateTime.Now),
                ProductMark = model.Mark,
                UserId      = login
            };

            comments.MarkList.Add(newMark);
            _commentsRepository.Update(comments);
            return(newMark);
        }
Esempio n. 3
0
 public void DeleteUserMovieMark(MarkEntity mark)
 {
     markRepository.Delete(mark.ToDalMark());
 }
Esempio n. 4
0
        public void DeleteMark(int id)
        {
            var Mark = MarkRepository.GetById(id);

            MarkRepository.Delete(Mark);
        }
Esempio n. 5
0
 public void Delete(int id)
 {
     _markRepository.Delete(id);
 }