public static string InsertProfileInfo(ProfileInfo pi) { CredentialAttempt ca = new CredentialAttempt(); //Need to created ETicket??????? ca.ETicket = Guid.NewGuid().ToString(); ca.ProfileInfo = pi; TimeStamps ts = new TimeStamps(){Initiated = DateTime.UtcNow}; ca.TimeStamps = ts; var newprofileinfo = BadgeApiDB.GetCollection("CredentialAttempt"); try { newprofileinfo.Insert(ca); } catch (Exception ex) { // To do find the result and return???? } return ca.ToJson(); }
public HttpResponseMessage PostRequestETicket(ProfileInfo pi) { if (ModelState.IsValid) { var result = QueryableDependencies.InsertProfileInfo(pi); return Request.CreateResponse(HttpStatusCode.OK, result); } else { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } }