コード例 #1
0
        /// <summary>
        /// Creates UpdateTaskCompletenessViewModel object with given Id and Completeness.
        /// </summary>
        /// <param name="id">Task id.</param>
        /// <param name="isCompleted">Task completeness</param>
        /// <returns>Created UpdateTaskCompletenessViewModel object.</returns>
        protected static UpdateTaskCompletenessViewModel BuildUpdateTaskCompletenessViewModel(int id           = 3,
                                                                                              bool isCompleted = false)
        {
            var updateTaskCompletenessViewModel = new UpdateTaskCompletenessViewModel()
            {
                Id          = id,
                IsCompleted = isCompleted
            };

            return(updateTaskCompletenessViewModel);
        }
コード例 #2
0
ファイル: TasksController.cs プロジェクト: DevVeryMe/TripFlip
        public async Task <IActionResult> UpdateCompletenessAsync(
            [FromBody] UpdateTaskCompletenessViewModel updateTaskCompletenessViewModel)
        {
            var updateTaskCompletenessDto =
                _mapper.Map <UpdateTaskCompletenessDto>(updateTaskCompletenessViewModel);

            var updatedTaskDto = await _taskService.UpdateCompletenessAsync(updateTaskCompletenessDto);

            var updatedTaskViewModel = _mapper.Map <UpdateTaskViewModel>(updatedTaskDto);

            return(Ok(updatedTaskViewModel));
        }