public bool CompartilharExame(string key) { var usuarioIdLogado = _usuarioAspNet.GetUsuarioId(); var exameComp = _exameCompRepository.ObterPorKey(key); if (exameComp == null) { AdicionarErroModelState("Exame não encontrado", "ExameService"); return(false); } _exameCompRepository.AdicionarUsuario(key, usuarioIdLogado); _uow.Commit(); return(!ExisteErrosNoModelState()); }
public IActionResult Compartilhado(string id) { if (this.User.Identity.IsAuthenticated) { var exameComp = _exameCompRepository.ObterPorKey(id); var res = _exameService.CompartilharExame(id); if (res) { return(RedirectToAction("VisualizarCompartilhado", new { id = exameComp.ExameId })); } return(RedirectToAction("Index", new { })); } else { return(RedirectToAction("Login", "Usuario")); } }