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)); }
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); }