/// <summary> /// Be careful! this method can act as save or update. So if you just /// want to save, make sure you have used contains() method before. /// </summary> /// <param name="vo"></param> public void save(GlassRecipeVo vo) { // check exists powderRepository.save(toPowder(vo)); grRepository.save(toGlassRecipe(vo)); }
public void testSave() { repository.deleteAll(); repository.save(new Powder("a")); repository.save(new Powder("a")); // skip cu'z name duplicated Assert.AreEqual(1, repository.count()); repository.save(new Powder("b")); Assert.AreEqual(2, repository.count()); repository.deleteAll(); repository.save(new Powder("a")); int id = repository.findByPowderName("a").get().Id; repository.save(new Powder(id, "b")); Assert.AreEqual(1, repository.count()); }
public void addPowder(Powder powder) { powderRepository.save(powder); PowdersUpdated(); }