Пример #1
0
        public IActionResult Post([FromBody] TaskLogAPI item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            TaskLog TaskLog = TaskLogAPI.To(item);

            try
            {
                TaskLog = new TaskLogBF(DB).Create(TaskLog);

                return(CreatedAtRoute(
                           "TaskLogRoute",
                           new
                {
                    controller = "TaskLog",
                    id = TaskLog.ID
                },
                           TaskLogAPI.From(TaskLog)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Пример #2
0
        private async void SaveCloseButton_Click(object sender, RoutedEventArgs e)
        {
            taskLog = await TaskLog.Save(taskLog);

            if (this.Frame.CanGoBack)
            {
                this.Frame.GoBack();
            }
        }
Пример #3
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            taskLog = await TaskLog.Save(taskLog);

            if (taskLog.id > 0)
            {
                TaskBugPicker.Visibility = Visibility.Collapsed;
                TaskBugTitle.Visibility  = Visibility.Visible;
                TaskBugTitle.Text        = taskLog?.task?.title ?? string.Empty;

                this.Bindings.Update();
            }
        }
Пример #4
0
        public IActionResult Get(long id)
        {
            TaskLog item = new TaskLogBF(DB).Get(id);

            if (item == null)
            {
                return(NotFound());
            }
            else
            {
                return(new ObjectResult(TaskLogAPI.From(item)));
            }
        }
Пример #5
0
        private void ButtonAddTask_Click(object sender, RoutedEventArgs e)
        {
            TaskLogAPI taskLog = new TaskLogAPI {
                logDateInternal = DateTime.Now.Date,
                startTime       = DateTime.Now.ToString("HH:mm"),
                endTime         = DateTime.Now.ToString("HH:mm")
            };

            ((Frame)Parent).Navigate(
                typeof(TaskLogs.TaskLogEdit),
                taskLog,
                new Windows.UI.Xaml.Media.Animation.DrillInNavigationTransitionInfo());
        }
Пример #6
0
        private async void taskList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            ListView listView = sender as ListView;

            if (null == listView)
            {
                return;
            }

            long       taskLogId = (listView.SelectedItem as TaskLogsAPI).id;
            TaskLogAPI taskLog   = await TaskLog.Get(taskLogId);

            ((Frame)Parent).Navigate(
                typeof(TaskLogs.TaskLogEdit),
                taskLog,
                new Windows.UI.Xaml.Media.Animation.DrillInNavigationTransitionInfo());
        }
Пример #7
0
        public IActionResult Put(long id, [FromBody] TaskLogAPI item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            try
            {
                TaskLog updateItem = new TaskLogBF(DB).Update(TaskLogAPI.To(item));

                return(new ObjectResult(TaskLogAPI.From(updateItem)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Пример #8
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter != null)
     {
         taskLog = e.Parameter as TaskLogAPI;
         if (taskLog.id <= 0)
         {
             TaskBugTitle.Visibility  = Visibility.Collapsed;
             TaskBugPicker.Visibility = Visibility.Visible;
             await LoadTaskCombo();
         }
         else
         {
             TaskBugTitle.Visibility  = Visibility.Visible;
             TaskBugPicker.Visibility = Visibility.Collapsed;
         }
     }
     else
     {
         taskLog = new TaskLogAPI();
     }
 }