Ejemplo n.º 1
0
 public UsersTaskViewModel(TaskItem task, List<State> states, List<string> names)
 {
     Task = task;
     States = new List<StateWithUserName>();
     for(int i = 0; i < states.Count; i++ ){
         StateWithUserName state = new StateWithUserName { State = states[i], Name = names[i] };
         States.Add(state);
     }
     
 }
Ejemplo n.º 2
0
        internal ScheduleItem MakeTask(string taskName, string taskDescription, ScheduleItem scheduleItem, object adminId)
        {
            string code = taskName;
            Regex rgx = new Regex("[^a-zA-Z0-9 -]");
            code = rgx.Replace(code, "");
            TaskItem task = new TaskItem { Name = taskName, Description = taskDescription, Code = code, States = new List<State>() };
            
            foreach (User student in db.Classes.Find(scheduleItem.ClassId).Users.Where(u => !u.Roles.Equals(adminId)))
            {
                task.States.Add(new State(student.Id));
            }
            var dir = Path.Combine(HttpRuntime.AppDomainAppPath, "/UploadedFiles/", db.Classes.Find(scheduleItem.ClassId).TaskPath, task.Code);
            Directory.CreateDirectory(dir);
            db.Tasks.Add(task);
            db.SaveChanges();
            scheduleItem.TaskId = task.Id;

            return scheduleItem;
        }
Ejemplo n.º 3
0
 public UserTaskViewModel(TaskItem task, State state, DateTime deadline)
 {
     Task = task;
     State = state;
     Deadline = deadline;
 }