public void AddLabel(TodoLabel todoLabel)
        {
            TodoLabel label = _context.TodoLabels.FirstOrDefault(l => l.Id == todoLabel.Id);

            if (label != null)
            {
                throw new DuplicateTodoLabelException("duplicate label id: {id}");
            }
            _context.TodoLabels.Add(todoLabel);
            _context.SaveChanges();
        }
Exemple #2
0
 protected bool Equals(TodoLabel other)
 {
     return(Id.Equals(other.Id));
 }
        public TodoLabel GetLabel(string value)
        {
            TodoLabel label = _context.TodoLabels.FirstOrDefault(l => l.Value == value);

            return(label);
        }