public static async Task<HttpResponseMessage> HttpRequestSetUserData(UserXML user) { var client = new HttpClient(new NativeMessageHandler()); client.BaseAddress = new Uri("http://"+ _serveur +":8080/"); client.Timeout = new TimeSpan(0, 0, 50); client.MaxResponseContentBufferSize = long.MaxValue; string s = "api/Users"; string json = JsonConvert.SerializeObject(user); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(s, content); return response; }
private UserXML CreateUser(int userId, string firstName, string lastName, DateTime birthdate, string adress, string city, int postcode, string pseudo, string password, int phoneNumber, string Photo) { UserXML u = new UserXML(); u.Adress = adress; u.Birthdate = birthdate; u.City = city; u.FirstName = firstName; u.LastName = lastName; u.Password = password; u.PhoneNumber = phoneNumber; u.PhotoPath = Photo; u.Photo = DependencyService.Get<IBytesSaveAndLoad>().LoadByteArray(Photo); u.Postcode = postcode; u.Pseudo = pseudo; u.UserId = userId; return u; }
public UserXML CreateUser(User user) { UserXML u = new UserXML(); u.Adress = user.Adress; u.Birthdate = user.Birthdate; u.City = user.City; u.FirstName = user.FirstName; u.LastName = user.LastName; u.Password = user.Password; u.PhoneNumber = user.PhoneNumber; u.PhotoPath = user.Photo; u.Photo = DependencyService.Get<IBytesSaveAndLoad>().LoadByteArray(user.Photo); u.Postcode = user.Postcode; u.Pseudo = user.Pseudo; u.UserId = user.UserId; return u; }