public async Task <IActionResult> Create(OrganizationRequestModel requestModel) { return(await ExecuteFunction(async (user) => { var model = AutoMapperUtils.AutoMap <OrganizationRequestModel, Organization>(requestModel); return await _organizationService.SaveAsync(model); })); }
private async Task AccessOrganization(string orgName) { IsBusy = true; try { var organization = await _organizationService.VerifyOrganization(orgName); if (organization?.StatusCode == 200) { if (!organization.RequiresAccessCode) { AppSettings.OrganizationId = organization.OrganizationID; AppSettings.UserAndOrganizationIds = $"{AppSettings.UserId}-{AppSettings.OrganizationId}"; RaisePropertyChanged(nameof(RegisterUser)); await NavigationService.NavigateAsync <SelectPositionViewModel, int>(organization.OrganizationID); } else { IsBusy = false; var result = await _dialogService.ShowTextInput(OrganizationLabel, organization.Name, string.Empty, EnterButton, AccessHint, InputType.Text); if (!string.IsNullOrEmpty(result)) { var orgCode = new OrganizationRequestModel(orgName, result); var res = await _organizationService.AccessCodeOrganization(orgCode); if (res.StatusCode == 200) { await NavigationService.NavigateAsync <SelectPositionViewModel, int>(organization.OrganizationID); } else { _dialogService.ShowAlert(_statusCodeService.GetStatusCodeDescription(res.StatusCode), AlertType.Error); } } } } else { _dialogService.ShowAlert(_statusCodeService.GetStatusCodeDescription(organization?.StatusCode), AlertType.Error); } } catch (Exception ex) { Ui.Handle(ex as dynamic); } finally { IsBusy = false; } }
public async Task <IActionResult> Update(Guid id, [FromBody] OrganizationRequestModel requestModel) { return(await ExecuteFunction(async (user) => { var model = await _organizationService.GetById(id); if (model == null) { throw new ArgumentException($"Id {id} không tồn tại"); } model = AutoMapperUtils.AutoMap <OrganizationRequestModel, Organization>(requestModel, model); return await _organizationService.SaveAsync(model); })); }
public async Task <bool> UpdateOrganizationMembershipRegions(OrganizationRequestModel model) { return(await _dataAccess.UpdateOrganizationMembershipRegions(model)); }
public async Task <int> RequestOrganizationMembership(OrganizationRequestModel model) { return(await _dataAccess.RequestOrganizationMembership(model)); }
public async Task <OrganizationAccessModel> AccessCodeOrganization(OrganizationRequestModel organizationCode) { return(await _webService.PostAsync <OrganizationAccessModel>("organization/verifycode", organizationCode, needsHeaderCheck : true).ConfigureAwait(false)); }