コード例 #1
0
        internal async Task <PendingTaskByDeveloperDto> SaveTask(NewTaskDto newTaskDto)
        {
            var task = new DevelopmentInfrastructure.Task()
            {
                SprintTrackId   = newTaskDto.SprintTrackId,
                Name            = newTaskDto.Name,
                TaskTypeId      = newTaskDto.TaskTypeId,
                CreateDate      = DateTime.Now,
                IsCompleted     = false,
                MediaServerPath = ""
            };

            await _context.Task.AddAsync(task);

            await _context.SaveChangesAsync();

            var newTask = await(from t in _context.Task.AsQueryable().AsNoTracking()
                                where t.Id == task.Id
                                select new PendingTaskByDeveloperDto()
            {
                SprintTrackId = t.SprintTrackId,
                TaskId        = t.Id,
                Name          = t.Name,
                Type          = t.TaskType.Name,
                StartDate     = t.CreateDate,
            }).FirstOrDefaultAsync();

            return(newTask);
        }
コード例 #2
0
        public async Task <IActionResult> Create([FromForm] NewTaskDto taskDto)
        {
            if (!ModelState.IsValid)
            {
                return(View("Create"));
            }
            var results = await _taskService.PostAsync(taskDto);

            if (results.StatusCode == HttpStatusCode.Created)
            {
                return(RedirectToAction("Index"));
            }
            ViewBag.Errors = new List <string>();
            ViewBag.Errors = results.Exception;
            return(View());
        }
コード例 #3
0
        public bool AddTask([FromBody]  NewTaskDto taskDto)
        {
            try
            {
                var group   = Context.Groups.Where(g => g.Id == taskDto.GroupId).FirstOrDefault();
                var newTask = new Task
                {
                    Title        = taskDto.Title,
                    Details      = taskDto.Details,
                    DueDate      = taskDto.DueDate,
                    CreationDate = DateTime.Now,
                    Group        = group
                };

                Context.Add(newTask);
                Context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #4
0
        public async Task <IActionResult> SaveTask([FromBody] NewTaskDto newTaskDto)
        {
            var response = await _projectsAppService.SaveTask(newTaskDto);

            return(Ok(response));
        }
コード例 #5
0
 public TaskDto AddNewTask([FromBody] NewTaskDto task)
 {
     return(new TaskDto(repositoryContext.AddNewTask(task.Task, userContext.Sid, task.Employee, task.Priority, task.Name)));
 }
コード例 #6
0
        public async Task <Result> PostAsync(NewTaskDto taskDto)
        {
            var task = _mapper.Map <NewTaskDto, Core.Domain.Task>(taskDto);

            return(await _taskRepository.Post(task));
        }
コード例 #7
0
        public async Task <JsonResult> CreateTask([FromBody] NewTaskDto taskDto)
        {
            var results = await _taskService.PostAsync(taskDto);

            return(new JsonResult(results));
        }