Beispiel #1
0
        public SessionRegistration GetRegSessions()
        {
            var claims = UserManager.GetClaims(User.Identity.GetUserId());
            SessionRegistration obj = new SessionRegistration();

            foreach (var claim in claims)
            {
                if (claim.Type == "ApplicationId")
                {
                    obj.AppId = Convert.ToInt32(claim.Value);
                }
                if (claim.Type == "GrantedSeats")
                {
                    obj.GrantedSeats = Convert.ToInt32(claim.Value);
                }
                if (claim.Type == "Discipline")
                {
                    obj.discipline = Convert.ToInt32(claim.Value);
                }
                if (claim.Type == "Category")
                {
                    obj.category = claim.Value;
                }
                if (claim.Type == "StudentId")
                {
                    obj.StudentId = Convert.ToInt32(claim.Value);
                }
            }
            return(obj);
        }
 public HttpResponseMessage Authorize(SessionRegistration request)
 {
     try
     {
         _registrationService.Authorize(User.Identity.Name, request.SessionId, request.Password);
         return(Request.CreateResponse(System.Net.HttpStatusCode.OK));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, new Exception(e.Message)));
     }
 }