コード例 #1
0
        public HttpResponseMessage AddItem(int listId, NameView input)
        {
            var list = InMemoryData.Lists.FirstOrDefault(x => x.Id == listId);

            if (list != null)
            {
                list.Items.Add(input.Name);
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            return(new HttpResponseMessage(HttpStatusCode.NotFound));
        }
コード例 #2
0
        public ListView AddList(NameView input)
        {
            var list = new ListView
            {
                Id    = InMemoryData.GetNextId(),
                Name  = input.Name,
                Items = new List <string>()
            };

            InMemoryData.Lists.Add(list);

            return(list);
        }