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); }
public async Task <ActionResult> Put(TodoViewModel model) { _service.Update(model.ToEntity()); return(new JsonResult(model)); }