public IActionResult CreateTask(int projectId, TaskDto taskDto) { var newTask = (DbMetadata.Models.Task)taskDto; //save id newTask.ProjectId = projectId; //save to project var project = _context.Projects .Include(p => p.Tasks) .SingleOrDefaultAsync(m => m.ProjectId == projectId); project.Result.Tasks.Add(newTask); _context.Tasks.Add(newTask); _context.SaveChanges(); return(Ok(new { tid = newTask.TaskId, action = "inserted" })); }
public void AddTheme(Theme theme) { _dbContext.Themes.Add(theme); _dbContext.SaveChanges(); }