示例#1
0
        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));
        }
示例#2
0
        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));
        }