Example #1
0
 public IHttpActionResult Post([FromBody] LoginMemberDTO model)
 {
     if (ModelState.IsValid)
     {
         var result = _dataAccessProvider.GetAuth(model.Email, model.Password);
         if (result == null)
         {
             return(new ResponseMessageResult(Request.CreateErrorResponse((HttpStatusCode)422, new HttpError("Form Error"))));
         }
         if (result.Length > 0)
         {
             return(Ok(new { AuthKey = result }));
         }
     }
     return(Unauthorized());
 }
Example #2
0
 public IHttpActionResult Post([FromBody] SaveMemberDTO model)
 {
     if (ModelState.IsValid)
     {
         var result = _dataAccessProvider.SaveMember(-1, model.FirstName, model.MiddleName, model.LastName, model.Gender, model.BirthDay, model.BirthMonth, model.BirthYear, model.Building, model.Street, model.City, model.State,
                                                     model.Zip, model.Email, model.Password, model.ContactPhone, -1, model.IPAddress);
         if (result.Length == 0)
         {
             var result2 = _dataAccessProvider.GetAuth(model.Email, model.Password);
             if (result2 == null)
             {
                 return(new ResponseMessageResult(Request.CreateErrorResponse((HttpStatusCode)422, new HttpError("Form Error"))));
             }
             if (result2.Length > 0)
             {
                 return(Ok(new { AuthKey = result2 }));
             }
             return(Unauthorized());
         }
         return(new ResponseMessageResult(Request.CreateErrorResponse((HttpStatusCode)422, new HttpError(Common.Common.ReplaceError(result)))));
     }
     return(new ResponseMessageResult(Request.CreateErrorResponse((HttpStatusCode)422, new HttpError("Form Error"))));
 }