Esempio n. 1
0
        public Assignment(AssignmentViewModel assignmentVM)
        {
            this.Id = assignmentVM.Id;
            this.Name = assignmentVM.Name;
            this.AssignmentDate = assignmentVM.AssignmentDate;
            this.DueDate = assignmentVM.DueDate;
            this.Points = assignmentVM.Points;

            Grades = new List<Grade>(assignmentVM.Grades.Count);
            foreach (GradeViewModel _grade in assignmentVM.Grades.Values)
            {
                Grades.Add(new Grade(_grade));
            }
        }
        public virtual ActionResult EditAssignment(
            [DataSourceRequest] DataSourceRequest request, 
            AssignmentViewModel task)
        {
            if (this.ModelState.IsValid)
            {
                var taskDb = this.subTaskService.GetById(task.Id);
                taskDb.PercentComplete = task.PercentComplete / 100;
                this.subTaskService.UpdateProgress(taskDb);

                if (task.PercentComplete == 100)
                {
                    this.messageService.SendSystemMessage(
                        this.UserProfile.Id, 
                        taskDb.Project.LeadId, 
                        SystemMessageType.TaskComplete, 
                        taskDb.Project.Id, 
                        taskDb.Id);
                }
            }

            return this.Json(request);
        }