Example #1
0
        public void CreateSprint(Model.Sprint sprint)
        {
            work.SprintRepository.Insert(sprint);
            work.SaveChanges();

            // throw new NotImplementedException();
        }
        public async Task <Model.Sprint> GenerateSprint(CreateSprint command)
        {
            await authorizationService.CheckUserMembership(callContext.UserId, command.ProjectId);

            if (!await projectSearcher.DoesProjectExist(command.ProjectId))
            {
                throw new EntityDoesNotExist(command.ProjectId, nameof(Project.Model.Project));
            }

            var sprint = new Model.Sprint(Guid.NewGuid(), command.ProjectId, command.Name, command.Start, command.End);

            sprint.Created();
            command.CreatedId = sprint.Id;
            return(sprint);
        }
Example #3
0
        /// <summary>
        /// Переводит спринт из серверной модели в клиентскую
        /// </summary>
        /// <param name="modelSprint">Спринт в серверной модели</param>
        /// <returns>Спринт в клиентской модели</returns>

        public static Client.Sprint Convert(Model.Sprint modelSprint)
        {
            if (modelSprint == null)
            {
                throw new ArgumentNullException();
            }

            var clientTasks = modelSprint.Tasks.Select(TaskConverter.Convert).ToArray();

            var clientSprint = new Client.Sprint
            {
                Number      = modelSprint.Number,
                Tasks       = clientTasks,
                Duration    = modelSprint.Duration,
                CreatedBy   = modelSprint.CreatedBy,
                Description = modelSprint.Description,
                Title       = modelSprint.Title
            };

            return(clientSprint);
        }
Example #4
0
        private Model.Sprint GetModelSprint(Client.SprintBuildInfo sprintBuildInfo, string userId)
        {
            if (sprintBuildInfo == null)
            {
                throw new ArgumentNullException();
            }

            var modelTasks = sprintBuildInfo.Tasks.Select(x => GetModelTask(x, userId)).ToArray();

            var modelSprint = new Model.Sprint
            {
                Number      = sprintBuildInfo.Number,
                Tasks       = modelTasks,
                Duration    = sprintBuildInfo.Duration,
                CreatedAt   = DateTime.Now,
                CreatedBy   = userId,
                Description = sprintBuildInfo.Description,
                Title       = sprintBuildInfo.Title
            };

            return(modelSprint);
        }
Example #5
0
 public void UpdateSprint(Model.Sprint sprint)
 {
     work.SprintRepository.Update(sprint);
     work.SaveChanges();
 }