public ActionResult Create(SimpleListItemViewModel simpleListItemViewModel) { var service = new ApiService(); service.CreateSimpleListItem(simpleListItemViewModel); return(RedirectToAction("Index", new { simpleListId = simpleListItemViewModel.SimpleListID })); }
public SimpleListItem SimpleListItemViewModelToSimpleListItem(SimpleListItemViewModel simpleListItemViewModel) { SimpleListItem simpleListItem = new SimpleListItem(); simpleListItem.ID = simpleListItemViewModel.ID; simpleListItem.Done = simpleListItemViewModel.Done; simpleListItem.Description = simpleListItemViewModel.Description; simpleListItem.SimpleListID = simpleListItemViewModel.SimpleListID; return(simpleListItem); }
public SimpleListItemViewModel SimpleListItemToSimpleListItemViewModel(DataModel.Models.SimpleListItem simpleListItem) { SimpleListItemViewModel simpleListItemViewModel = new SimpleListItemViewModel(); simpleListItemViewModel.ID = simpleListItem.ID; simpleListItemViewModel.Done = simpleListItem.Done; simpleListItemViewModel.Description = simpleListItem.Description; simpleListItemViewModel.SimpleListID = simpleListItem.SimpleListID; return(simpleListItemViewModel); }
public void SimpleListItemViewModelToSimpleListItemTest() { Mapper target = new Mapper(); // TODO: Initialize to an appropriate value SimpleListItemViewModel simpleListItemViewModel = null; // TODO: Initialize to an appropriate value SimpleListItem expected = null; // TODO: Initialize to an appropriate value SimpleListItem actual; actual = target.SimpleListItemViewModelToSimpleListItem(simpleListItemViewModel); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public int CreateSimpleListItem(SimpleListItemViewModel simpleListItemViewModel) { // Authenticate. var user = GetUserCredentials(); if (user == null) { return(0); } var mapper = new Mapper(); var simpleListItem = mapper.SimpleListItemViewModelToSimpleListItem(simpleListItemViewModel); _simpleListItemRepository = new SimpleListItemRepository(); return(_simpleListItemRepository.AddSimpleListItem(simpleListItem)); }
public void SimpleListItemToSimpleListItemViewModelTest() { Mapper target = new Mapper(); // TODO: Initialize to an appropriate value SimpleListItem simpleListItem = new DataModel.Models.SimpleListItem { ID = 1, Description = "test list item 1", Done = false, SimpleListID = 1 }; SimpleListItemViewModel expected = new SimpleListItemViewModel { ID = 1, Description = "test list item 1", Done = false, SimpleListID = 1 }; SimpleListItemViewModel actual; actual = target.SimpleListItemToSimpleListItemViewModel(simpleListItem); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Done, actual.Done); Assert.AreEqual(expected.ID, actual.ID); Assert.AreEqual(expected.SimpleListID, actual.SimpleListID); }