예제 #1
0
        public void Create(Todo todo)
        {
            if (Todos.Any(x => x.Id.Equals(todo.Id)))
            {
                throw new ArgumentException("Todo with given Id already exists");
            }
            Todo t = new Todo();

            t.CopyFrom(todo, true);
            Todos.Add(t);
        }
예제 #2
0
        public static void CreateNewTask(dynamic metadata, dynamic content)
        {
            var description = content.Description.ToString();
            var parentId    = content.ParentId.ToString();
            var id          = metadata.ReferenceKey.ToString();
            var groupKey    = metadata.GroupKey.ToString();
            var memberKey   = metadata.MemberKey.ToString();

            if (!Todos.Any(t => (t.Id == id || (t.ParentId == parentId && t.Description == description) && t.GroupKey == groupKey && t.MemberKey == memberKey)))
            {
                AddTask(id, groupKey, memberKey, description, parentId, GetCreateDate(metadata), TodoType.Task);
            }
            else
            {
                SendFeedbackMessage(type: MsgType.Error, actionTime: GetCreateDate(metadata), action: MapAction.TaskFeedback.CannotAddTask.Name, content: "Cannot add task id or description are duplicated!");
            }
        }