コード例 #1
0
        public int ChangePosition(string json)
        {
            int update = 0;
            var msg    = ser.Deserialize <List <JsonObj> >(json);

            for (int i = 0; i < msg.Count; i++)
            {
                var item = TaskListService.Get(msg[i].list);
                for (int j = 0; j < msg[i].cards.Length; j++)
                {
                    var card = CardService.Get(msg[i].cards[j]);
                    if (item.Cards.Contains(card))
                    {
                        if (item.Cards[j].Position != j)
                        {
                            item.Cards[j].Position = j;
                            update = CardService.Update(item.Cards[j]);
                        }
                    }
                    else
                    {
                        card.TaskListId = item.Id;
                        card.Position   = j;
                        update          = CardService.Update(card);
                    }
                }
            }

            return(update);
        }
コード例 #2
0
        public int Delete(int listId)
        {
            var         map      = mapper.CreateMapper();
            TaskListDTO taskList = TaskListService.Get(listId);
            int         i        = TaskListService.Delete(taskList);

            return(i);
        }
コード例 #3
0
        public int Create(string name, int id, string description)
        {
            var         map      = mapper.CreateMapper();
            TaskListDTO taskList = TaskListService.Get(id);
            CardDTO     card     = new CardDTO {
                Name = name, TaskListId = taskList.Id, Description = description
            };

            int i = card.Id = CardService.Create(card);

            return(i);
        }
コード例 #4
0
 public IEnumerable <TaskList> Get()
 {
     return(_taskListService.Get());
 }