// POST api/boardapi public List Post([FromBody] CreateList input) { using (var ctx = new BoardContext()) { Board board = ctx.Boards.Where(b => b.Id == input.BoardId).First(); var list = new List {Name = input.name}; board.Lists.Add(list); ctx.Set<List>().Add(list); ctx.SaveChanges(); return list; } }
// POST api/boardtask public Task Post([FromBody] CreateTask value) { using (var ctx = new BoardContext()) { Board board = ctx.Boards.First(b => b.Id == value.BoardId); var t = new Task {Name = value.name}; board.Lists.First().InsertTask(0, t); ctx.Set<Task>().Add(t); ctx.SaveChanges(); return t; } }