public ActionResult Participants(int eventId)
 {//_participantService.Get(eventId)
     try
     {
         return(PartialView(_participantService.Get(eventId)));
     }
     catch (Exception)
     {
         return(Json(new { message = Localization.Localization.ErrorGeneralException, success = false }));
     }
 }
Пример #2
0
        /// <summary>
        /// Creates an identity object for a participant that matches the specified 'key'.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static ClaimsIdentity CreateIdentity(this IParticipantService service, Guid key)
        {
            if (key == Guid.Empty)
            {
                return(null);
            }

            var participant = service.Get(key);
            var claims      = service.GetClaims(participant.Id.Value);

            return(new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme));
        }
Пример #3
0
 public IHttpActionResult Get(string participantId)
 {
     try
     {
         var participant = _service.Get(participantId);
         return(Ok(participant));
     }
     catch (Exception ex)
     {
         HandleServerError(ex);
         return(InternalServerError());
     }
 }
        public ActionResult Index(int id)
        {
            try
            {
                var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(ApplicationDbContext.Create()));
                var eventInfo   = _eventService.Get(id);
                eventInfo.Id = id;

                var author = userManager.FindById(eventInfo.UserId).UserName;

                return(View(new EventViewModel
                {
                    Event = eventInfo,
                    Participants = _participantService.Get(id),
                    Author = author
                }));
            }
            catch (Exception)
            {
                return(Json(new { message = Localization.Localization.ErrorGeneralException, success = false }));
            }
        }