public IActionResult Update([FromBody] Theme theme) { int success = _themeRepo.Update(theme); if (success == 0) { return(Ok()); } else { return(NotFound()); } }
public void Should_update_theme() { const string newThemeDescription = "New Description 1"; var themeToUpdate = ThemeFactory.Theme(_themeId1, "Name 1", newThemeDescription, "Folder 1"); using (var context = new WeapsyDbContext(_contextOptions)) { var repository = new ThemeRepository(Shared.CreateNewContextFactory(context), Shared.CreateNewMapper()); repository.Update(themeToUpdate); } using (var context = new WeapsyDbContext(_contextOptions)) { var repository = new ThemeRepository(Shared.CreateNewContextFactory(context), Shared.CreateNewMapper()); var updatedTheme = repository.GetById(_themeId1); Assert.AreEqual(newThemeDescription, updatedTheme.Description); } }
public ActionResult Edit(FormCollection collection) { try { Theme item = _themeRepository.GetById(new Guid(collection["Id"])); item.Title = collection["Title"]; item.Description = collection["Description"]; _themeRepository.Update(item); Request.Flash("success", "Thema is gewijzigd"); return(RedirectToAction("Index")); } catch (Exception e) { Request.Flash("error", "Er is iets mis gegaan: " + e.Message); return(RedirectToAction("Index")); } }
public virtual void Update(Theme obj) { _themeRepository.Update(obj); }