public UpdateProfileResponse UpdateProfile(UpdateProfileRequest updateProfileReq) { return HttpRequestAdapter.WebHttpPostRequest<UpdateProfileResponse>(_serviceBaseUrl, "Profile/Update", updateProfileReq, String.Concat("?apikey=", _apiKey)); }
public UpdateProfileResponse UpdateProfile(UpdateProfileRequest updateProfileReq) { UpdateProfileResponse response = new UpdateProfileResponse(); try { Traveler traveler = _repository.FindBy<Traveler>(t => t.TravelerID == _currentTravelerId); traveler.Firstname = updateProfileReq.Firstname ?? traveler.Firstname; traveler.Lastname = updateProfileReq.Lastname ?? traveler.Lastname; traveler.StatusMessage = updateProfileReq.StatusMessage ?? traveler.StatusMessage; traveler.Gender = updateProfileReq.Gender ?? traveler.Gender; traveler.Birthdate = (!String.IsNullOrEmpty(updateProfileReq.Birthdate)) ? DateTime.Parse(updateProfileReq.Birthdate) : traveler.Birthdate; traveler.IsAvailable = updateProfileReq.IsAvailable ?? traveler.IsAvailable; _repository.Save<Traveler>(traveler); _repository.Commit(); response.Profile = traveler.ConvertToTravelerView(); response.MarkSuccess(R.String.SuccessMessages.SuccessProfileUpdate); } catch (Exception ex) { ReportError(ex, response); } return response; }