Exemplo n.º 1
0
        private async System.Threading.Tasks.Task saveHours()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var hours = EntitySaveHelper.GetUserClockForSave(Hours);
                if (hours.UserClockId == null)
                {
                    await DataService.PostItemAsync <UserClock>("userClocks", hours);
                }
                else
                {
                    await DataService.PutItemAsync <UserClock>("userClocks", hours.UserClockIdValue, Hours);
                }

                MessagingCenter.Send <HoursEditViewModel>(this, SUCCESS);
                IsBusy = false;
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }