Ejemplo n.º 1
0
        public async Task <Result> Create(string name, int projectId, string priority, string description)
        {
            var projectResult = await _projectRepository.Get(projectId);

            if (projectResult.Failure)
            {
                return(projectResult);
            }

            var result = ProjectTask.Create(name, projectResult.Value, priority, description);

            if (result.Failure)
            {
                return(result);
            }

            await _context.Tasks.AddAsync(result.Value);

            await _context.SaveChangesAsync();

            return(result);
        }