public ActionResult Login(int UserID) { using (var db = new QuesoContext()) { Session["UserID"] = db.Users.Find(UserID).UserID; return(Redirect("/Board")); } }
public ActionResult Index() { using (var db = new QuesoContext()) { board = db.Boards.OrderByDescending(x => x.BoardID).FirstOrDefault(); } return(Redirect("/Board/Show/" + board.BoardID)); }
public ActionResult Edit(int id) { Board board; using (var db = new QuesoContext()) { board = db.Boards.FirstOrDefault(x => x.BoardID == id); } return(View(board)); }
public ActionResult Index() { List <User> users; using (var db = new QuesoContext()) { users = db.Users.ToList(); ViewBag.Users = users; } return(View(users)); }
public ActionResult Add() { List <Task> tasks; using (var db = new QuesoContext()) { tasks = db.Tasks.ToList(); } return(View(tasks)); }
public ActionResult Index() { List <TaskPool> tasks; using (var db = new QuesoContext()) { tasks = db.TaskPool.ToList(); } return(View(tasks)); }
public ActionResult Edit(TaskPool tasks) { using (var db = new QuesoContext()) { if (ModelState.IsValid) { db.Entry(tasks).State = EntityState.Modified; db.SaveChanges(); } } return(View(tasks)); }
//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)); }
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")); }
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)); }
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()); }