예제 #1
0
        public void EndTaskByUser(int taskId, string userId)
        {
            var task = this.context.Tasks.Single(t => t.Id == taskId && t.ApplicationUserId == userId);

            task.EndTime = DateTime.Now;
            int spentStoryPoints = (int)(task.EndTime - task.StartTime).Value.TotalHours;

            var endedTask = new EndedTask
            {
                TaskId            = task.Id,
                ProjectId         = task.ProjectId,
                ApplicationUserId = task.ApplicationUserId,
                Name             = task.Name,
                Description      = task.Description,
                Priority         = task.Priority,
                StoryPoints      = task.StoryPoints,
                SpentStoryPoints = spentStoryPoints,
                StartTime        = task.StartTime,
                EndTime          = task.EndTime
            };

            this.context.EndedTasks.Add(endedTask);

            this.context.Remove(task);
            this.context.SaveChanges();
        }
 public void Remove(EndedTask data)
 {
     throw new NotImplementedException();
 }
 public EndedTask Edit(EndedTask data)
 {
     throw new NotImplementedException();
 }