コード例 #1
0
        public void create_new_todo_list()
        {
            service.CreateList(new TodoList {
                Id = 1, Name = "1st List"
            });
            service.CreateList(new TodoList {
                Id = 1, Name = "2nd List"
            });
            var lists = service.GetTodoLists();

            Assert.IsTrue(lists.Result.Count > 1);
        }
コード例 #2
0
ファイル: TodoController.cs プロジェクト: sxkote/DemoTools
 public void AddTodoList([FromBody] ModifyTodoListDTO dto)
 {
     if (String.IsNullOrEmpty(dto.Title))
     {
         throw new SX.Common.Shared.Exceptions.CustomInputException("Empty Todo-List Title!");
     }
     _todoService.CreateList(dto.Title);
 }
コード例 #3
0
        public IActionResult PostTodoList([FromBody]TodoList list)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            int createdId;
            try
            {
                createdId = _service.CreateList(list);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }

            return CreatedAtAction("PostTodoList", new { id = createdId }, list);
        }
コード例 #4
0
        public IActionResult PostTodoList([FromBody] TodoList list)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            int createdId;

            try
            {
                createdId = _service.CreateList(list);
            }
            catch
            {
                return(BadRequest());
            }

            return(CreatedAtAction("PostTodoList", new { id = createdId }, list));
        }