public HttpResponseMessage Post(ClientRegisterData data) { string name = data.name; string email = data.email; string password = data.password; string address = data.address; string nif = data.nif; string adminCode = data.adminCode; string type = "cliente"; string telemovel = data.telemovel; string localidade = data.localidade; string cp = data.cp; Debug.Write(name + "\n"); Debug.Write(email + "\n"); Debug.Write(password + "\n"); Debug.Write(address + "\n"); Debug.Write(nif + "\n"); Debug.Write(telemovel + "\n"); Debug.Write(localidade + "\n"); Debug.Write(cp + "\n"); //Por agora até alguém alterar no pedido if (adminCode != null && System.Text.RegularExpressions.Regex.Match(adminCode, patternToMatch, System.Text.RegularExpressions.RegexOptions.IgnoreCase).Success) { type = "admin"; Debug.Write("\n it passed the regex\n"); } if (email != null && password != null && address != null && nif != null && name != null && telemovel != null && localidade != null && cp != null) { //checks if login is correct int registerStatus = register(email, password, name, address, nif, type, telemovel, localidade, cp); Debug.Write(name + "\n"); Debug.Write(registerStatus); if (registerStatus == 1) { var response = Request.CreateResponse( HttpStatusCode.OK, new { registered = "true" }); //string uri = Url.Link("DefaultApi", new { CodCliente = data.email }); //response.Headers.Location = new Uri(uri); return(response); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } } else { // if email or password is null, immediately send bad request return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public HttpResponseMessage Post(ClientRegisterData data) { String testVar = "le success est tré bon"; ViewBag.testVar = testVar; var response = Request.CreateResponse( HttpStatusCode.OK, new { }); return(response); return View("~/Views/Wherever/SomeDir/MyView.aspx") }