예제 #1
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var command = new CreateOrUpdateZoneCommand()
            {
                LocaleId    = localeProvider.Locale !.Id,
                Name        = name.Text,
                Description = description.Text,
                Floor       = Convert.ToInt32(floor.Text)
            };

            if (!activityIndicator.IsRunning)
            {
                try
                {
                    activityIndicator.IsRunning = true;
                    await zonesService.CreateZone(command);

                    await localeProvider.RefreshLocale();

                    activityIndicator.IsRunning = false;
                    await Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                    activityIndicator.IsRunning = false;
                    await DisplayAlert(AppResources.Error, ex.Message, "OK");
                }
            }
        }
    }
예제 #2
0
 public async Task <ActionResult <Zone> > CreateZone(
     [FromServices] IZoneService zoneService,
     [FromBody] CreateOrUpdateZoneCommand command)
 {
     return(await zoneService.CreateZone(command));
 }