Esempio n. 1
0
 public HttpResponseMessage ValidateInvitation([FromBody] BO.UserPasswordActivation data)
 {
     if (data != null)
     {
         return(InvitationRequestHandler.ValidateInvitation(Request, data));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, new BO.ErrorObject {
             ErrorMessage = "Invalid data", errorObject = "", ErrorLevel = BO.ErrorLevel.Critical
         }));
     }
 }
        public override object ValidateInvitation <T>(T data)
        {
            BO.UserPasswordActivation invitationBO = (BO.UserPasswordActivation)(object) data;
            EO.UserPasswordActivation invitation   = _context.UserPasswordActivations.Where(p => p.PasswordActivattionKey == invitationBO.PasswordActivattionKey).FirstOrDefault <EO.UserPasswordActivation>();
            //p.IsExpired != true &&

            if (invitation != null)
            {
                invitation.IsExpired             = true;
                _context.Entry(invitation).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();
            }

            else
            {
                return(new BO.ErrorObject {
                    ErrorMessage = "Invalid appkey or other parameters.", errorObject = "", ErrorLevel = BO.ErrorLevel.Error
                });
            }
            return((object)(invitation));
        }