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); } } }
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); }
public void DeleteUserMovieMark(MarkEntity mark) { markRepository.Delete(mark.ToDalMark()); }
public void DeleteMark(int id) { var Mark = MarkRepository.GetById(id); MarkRepository.Delete(Mark); }
public void Delete(int id) { _markRepository.Delete(id); }