public TrainerImageViewModel (byte[] image = null)
		{
			if (image != null) {
				ImageByteArray = image;
				if (CrossConnectivity.Current.IsConnected) {
					TrainerImageDTOProperty = new TrainerImageDTO ();
				} else {
					DependencyService.Get<ICustomDialog> ().Display (StringConstants._FeatureConnectivityDepencyMessage, "OK");
				}
				postImageCommand = new Command (OnPostImage);
				closeCommand = new Command (OnClosed);
			} 
		}
Exemple #2
0
		public static async Task<int> PostTrainerImage(TrainerImageDTO trainerImageDTO)
		{
			string serviceType = "SaveTrainerImage";
			string rawJSON = JsonConvert.SerializeObject(trainerImageDTO);
			var stringResponse = await BaseCoachServices.ServiceAPI.Post(serviceType, rawJSON);
			if (stringResponse == "401")
			{
				if (await TokenManager.RefreshToken())
				{
					stringResponse = await BaseCoachServices.ServiceAPI.Post(serviceType, rawJSON);
				}
			}
			int intResponse = 0;
			int.TryParse(stringResponse, out intResponse);

			return intResponse;
		}