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); }
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()); }
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); } }
public async Task <IActionResult> SaveTask([FromBody] NewTaskDto newTaskDto) { var response = await _projectsAppService.SaveTask(newTaskDto); return(Ok(response)); }
public TaskDto AddNewTask([FromBody] NewTaskDto task) { return(new TaskDto(repositoryContext.AddNewTask(task.Task, userContext.Sid, task.Employee, task.Priority, task.Name))); }
public async Task <Result> PostAsync(NewTaskDto taskDto) { var task = _mapper.Map <NewTaskDto, Core.Domain.Task>(taskDto); return(await _taskRepository.Post(task)); }
public async Task <JsonResult> CreateTask([FromBody] NewTaskDto taskDto) { var results = await _taskService.PostAsync(taskDto); return(new JsonResult(results)); }