protected string ExecutePost(MethodApi nameMethod, IDictionary <string, string> parameters, IList <int> bodyForPost) { var url = UriBuilder(parameters); return(_httpRequestHelper.ExecutePost(url, bodyForPost)); }
/// <summary> /// Определяет какой MethodApi содержится в url /// и возвращает соответствующий ему Json /// </summary> /// <param name="url"></param> /// <returns>В зависимости от MethodApi возвращает соответствующий ему Json</returns> private string GetDataForMethodApi(string url) { MethodApi methodApi = _methodsApi.FirstOrDefault(method => url.Contains(method.ToString())); byte[] bytesRes; switch (methodApi) { case MethodApi.GetFaculties: bytesRes = Properties.Resources.GetFaculties; break; case MethodApi.GetSpecialtys: bytesRes = Properties.Resources.GetSpecialtys; break; case MethodApi.GetCourses: bytesRes = Properties.Resources.GetCourses; break; case MethodApi.GetGroups: bytesRes = Properties.Resources.GetGroups; break; case MethodApi.GetPulpit: bytesRes = Properties.Resources.GetPulpit; break; case MethodApi.GetTeacher: bytesRes = Properties.Resources.GetTeacher; break; case MethodApi.GetGroupLessons: bytesRes = Properties.Resources.GetGroupLessons; break; case MethodApi.GetTeacherLessons: bytesRes = Properties.Resources.GetTeacherLessons; break; case MethodApi.GetLessonTime: bytesRes = Properties.Resources.GetLessonTime; break; default: throw new ArgumentException( "Неудалось определить метод запроса! url = " + url); } return(System.Text.Encoding.UTF8.GetString(bytesRes)); }
public CreateUserViewModel() { GoCreateUser = new Command(async() => await CreateUser()); MA = new MethodApi(); }
protected string ExecuteGet(MethodApi nameMethod, IDictionary <string, string> parameters) { var url = UriBuilder(parameters); return(_httpRequestHelper.ExecuteGet(url)); }
public LoginViewModel(INavigation navigation) { Navigation = navigation; GoToConfirmLogin = new Command(async() => await GoConfirmLogin()); MA = new MethodApi(); }