public ActionResult FavoriteRepository(int id) { var repository = _service.GetById(id); if (_service.CreateFavorite(repository)) { return(RedirectToAction("Favorites")); } else { TempData["mensagemErro"] = "Não foi possível favoritar o repositório."; return(RedirectToRoute(new { controller = "Home", action = "Details", id })); } }
public ViewResult Index() { var context = new DataContext(); var rfxRepository = new RepositoryService<Rfx>(context); var result = rfxRepository.GetById(1); result.Name = "Books"; rfxRepository.Update(result); return View(rfxRepository.GetAll()); }
public TEntity GetById(TKey id) { using var uow = UnitOfWorkProvider.Create(); return(RepositoryService.GetById(id, new IIncludeDefinition <TEntity>[] { })); }