Esempio n. 1
0
 public ActionResult Login(int UserID)
 {
     using (var db = new QuesoContext())
     {
         Session["UserID"] = db.Users.Find(UserID).UserID;
         return(Redirect("/Board"));
     }
 }
Esempio n. 2
0
 public ActionResult Index()
 {
     using (var db = new QuesoContext())
     {
         board = db.Boards.OrderByDescending(x => x.BoardID).FirstOrDefault();
     }
     return(Redirect("/Board/Show/" + board.BoardID));
 }
Esempio n. 3
0
        public ActionResult Edit(int id)
        {
            Board board;

            using (var db = new QuesoContext())
            {
                board = db.Boards.FirstOrDefault(x => x.BoardID == id);
            }
            return(View(board));
        }
Esempio n. 4
0
        public ActionResult Index()
        {
            List <User> users;

            using (var db = new QuesoContext())
            {
                users         = db.Users.ToList();
                ViewBag.Users = users;
            }
            return(View(users));
        }
Esempio n. 5
0
        public ActionResult Add()
        {
            List <Task> tasks;

            using (var db = new QuesoContext())
            {
                tasks = db.Tasks.ToList();
            }

            return(View(tasks));
        }
Esempio n. 6
0
        public ActionResult Index()
        {
            List <TaskPool> tasks;

            using (var db = new QuesoContext())
            {
                tasks = db.TaskPool.ToList();
            }

            return(View(tasks));
        }
Esempio n. 7
0
 public ActionResult Edit(TaskPool tasks)
 {
     using (var db = new QuesoContext())
     {
         if (ModelState.IsValid)
         {
             db.Entry(tasks).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     return(View(tasks));
 }
Esempio n. 8
0
        //Get: /Taskpool/Edit
        public ActionResult Edit()
        //{
        //    using (var db = new QuesoContext())
        //    {
        //        TaskPool tasks = db.TaskPool.Find(id);
        //        return View(tasks);
        //    }
        // }
        {
            List <Task> tasks;

            using (var db = new QuesoContext())
            {
                tasks = db.Tasks.ToList();
            }

            return(View(tasks));
        }
Esempio n. 9
0
        public ActionResult Answer(int UserID, int TaskID, string CaseNumber)
        {
            using (var db = new QuesoContext())
            {
                var task = db.Tasks.Where(x => x.TaskID == TaskID).FirstOrDefault();
                var user = db.Users.Where(x => x.UserID == UserID).FirstOrDefault();

                var answer = new Answer();
                answer.Task       = task;
                answer.User       = user;
                answer.CreatedAt  = System.DateTime.Now;
                answer.CaseNumber = CaseNumber;

                db.Answers.Add(answer);
                db.SaveChanges();
            }
            return(Redirect("/Board"));
        }
Esempio n. 10
0
        public ActionResult Show(int id)
        {
            using (var db = new QuesoContext())
            {
                //board = db.Boards.Find(id);
                board = db.Boards.Include("Tasks").FirstOrDefault(x => x.BoardID == id);

                if (board != null)
                {
                    var temp = board.Tasks.ToList();
                    board.Tasks = new List <Task>();

                    board.Tasks.AddRange(temp.GetRange(0, 12));
                    board.Tasks.Add(temp.Last());
                    board.Tasks.AddRange(temp.GetRange(12, 12));

                    //var user =
                }
            }

            return(View(board));
        }
Esempio n. 11
0
        public ActionResult New()
        {
            using (var db = new QuesoContext())
            {
                board        = new Board();
                board.Active = true;


                var poolTasks = TaskPool.Random();
                foreach (var poolTask in poolTasks)
                {
                    var task = new Task()
                    {
                        Name      = poolTask.Name,
                        Challenge = poolTask.Challenge
                    };
                    board.Tasks.Add(task);
                }
                db.Boards.Add(board);
                db.SaveChanges();
            }
            return(View());
        }