public async Task Store(TreeService treeService) { System.Diagnostics.Debug.WriteLine("Family {0}", this.family.Id); await treeService.Update(this.family).ConfigureAwait(false); await treeService.UpdateRelations(this.family.Id, this.spouses, this.children).ConfigureAwait(false); }
public IActionResult Update(string id, Tree treeIn) { var tree = _treeService.Get(id); if (tree == null) { return(NotFound()); } _treeService.Update(id, treeIn); return(NoContent()); }
public ActionResult Edit(Tree model) { if (ModelState.IsValid) { var user = GetUser(); model.UserID = user.ID; TreeService.Update(model); var path = Server.MapPath("/label"); var bytes = TreeTagPainter.Paint(model, HttpContext.Request.Url.Host); System.IO.File.WriteAllBytes(path + "/" + model.ID + ".png", bytes); return(RedirectToAction("Index")); } else { return(View(model)); } }
public async Task Store(TreeService treeService) { System.Diagnostics.Debug.WriteLine("Individual {0}, {1} {2}", this.individual.Id, this.individual.Firstnames, this.individual.Lastname); await treeService.Update(this.individual).ConfigureAwait(false); }
public void Update(int id, Tree tree) { _service.Update(id, tree); }
public void TreeService_Update_Calls_UnitOfWork_Commit_Method_() { // Create test data var tree = new Tree { Name = "Foo" }; //Create Mock var mockRepository = new Mock<IRepository<Tree>>(); _mockUnitOfWork.Setup(d => d.GetRepository<Tree>()).Returns(mockRepository.Object); //Arrange _service = new TreeService(_mockUnitOfWork.Object); //Act _service.Update(tree); //Assert _mockUnitOfWork.Verify(db => db.Commit()); }
public void TreeService_Update_Calls_Repository_Update_Method_With_The_Same_Tree_Object_It_Recieved() { // Create test data var tree = new Tree { Name = "Foo" }; //Create Mock var mockRepository = new Mock<IRepository<Tree>>(); _mockUnitOfWork.Setup(d => d.GetRepository<Tree>()).Returns(mockRepository.Object); //Arrange _service = new TreeService(_mockUnitOfWork.Object); //Act _service.Update(tree); //Assert mockRepository.Verify(r => r.Update(tree)); }