コード例 #1
0
        public void ToEntity_Converts_To_Todo()
        {
            var todoViewModel = new TodoViewModel()
            {
                ID = 1, Completed = true, Description = "Task 1"
            };

            var result = todoViewModel.ToEntity();

            Assert.IsInstanceOf <Todo>(result);
            Assert.AreEqual(result.ID, todoViewModel.ID);
            Assert.AreEqual(result.Completed, todoViewModel.Completed);
            Assert.AreEqual(result.Description, todoViewModel.Description);
        }
コード例 #2
0
        public async Task <ActionResult> Put(TodoViewModel model)
        {
            _service.Update(model.ToEntity());

            return(new JsonResult(model));
        }