public ActionResult ShowEvent(long?id) { var _event = _SportEventRepository.Get((long)id); var newEvent = new SportEventViewModel(); newEvent.title = _event.title; newEvent.description = _event.description; return(View(newEvent)); }
public SportEvent GetEvent() { var idStr = _httpContextAccessor .HttpContext.User.Claims.SingleOrDefault(x => x.Type == "Id")?.Value; if (string.IsNullOrEmpty(idStr)) { return(null); } var id = int.Parse(idStr); return(_sportEventRepository.Get(id)); }