Esempio n. 1
0
        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 }));
            }
        }
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
 public TEntity GetById(TKey id)
 {
     using var uow = UnitOfWorkProvider.Create();
     return(RepositoryService.GetById(id, new IIncludeDefinition <TEntity>[] { }));
 }