public ActionResult saveNewAssignment(Assignment a) { var uniqueness = ""; var fileSavePath = ""; if (Request.Files["ProblemLink"] != null) { var file = Request.Files["ProblemLink"]; if (file.FileName != "") { var ext = System.IO.Path.GetExtension(file.FileName); uniqueness = Guid.NewGuid().ToString() + ext; var rootPath = Server.MapPath("~/Assignments"); fileSavePath = System.IO.Path.Combine(rootPath, uniqueness); file.SaveAs(fileSavePath); } a.ProblemLink = fileSavePath; a.CourseCode = Session["course"].ToString(); AssignmentDAL.insert(a); } String id = Session["course"].ToString(); List <Assignment> list = AssignmentDAL.getCourseAssignments(id); return(View("Assignments", list)); // return View("Assignments"); }
public ActionResult AccountCreation() { EmployeeVM employee = new EmployeeVM(); employee.TeamList = Mapper.Map <List <TeamsVM> >(TeamsDAL.ReadTeams()); employee.AssignmentList = Mapper.Map <List <AssignmentVM> >(AssignmentDAL.ReadAssignments()); employee.RoleList = Mapper.Map <List <RolesVM> >(RolesDAL.ReadRoles()); return(View(employee)); }
public ActionResult CreateKPI() { KPIVM kpi = new KPIVM(); kpi.Assignments = Mapper.Map <List <AssignmentVM> >(AssignmentDAL.ReadAssignments()); kpi.Projects = Mapper.Map <List <ProjectVM> >(ProjectDAL.ReadProjects()); kpi.Sprints = Mapper.Map <List <SprintVM> >(SprintDAL.ReadSprints()); kpi.Stories = Mapper.Map <List <StoryVM> >(StoryDAL.ReadStorys()); return(View(kpi)); }
public ActionResult Assignments(string id) { //ViewData["course"] = id; // ViewBag.course = id; Session["course"] = id; List <Assignment> list = AssignmentDAL.getCourseAssignments(id); return(View("Assignments", list)); }
public void Assignment_AssignScenario_Test() { //Arrange IAssignmentDAL dao = new AssignmentDAL(ConnectionString); //Action bool test = dao.AssignScenario(1, 3); //Assert Assert.IsTrue(test); }
public ActionResult UpdateKPI(string id) { KPIVM kpi = new KPIVM(); kpi = Mapper.Map <KPIVM>(KPI_DAL.ReadKPIById(id)); kpi.Stories = Mapper.Map <List <StoryVM> >(StoryDAL.ReadStorys()); kpi.Projects = Mapper.Map <List <ProjectVM> >(ProjectDAL.ReadProjects()); kpi.Sprints = Mapper.Map <List <SprintVM> >(SprintDAL.ReadSprints()); kpi.Assignments = Mapper.Map <List <AssignmentVM> >(AssignmentDAL.ReadAssignments()); return(View(kpi)); }
public void Assignment_GetAllTeachers_Test() { //Arrange IAssignmentDAL dao = new AssignmentDAL(ConnectionString); IList <User> testList = new List <User>(); testList = dao.GetAllStudents(); //Action int results = GetRowCount("users", "Teacher"); //Assert Assert.AreEqual(results, testList.Count); }
public ActionResult Download() { int id = (int)Session["assignment"]; Assignment ass = AssignmentDAL.getSpecificAssignment(id); string fullName = ass.ProblemLink; string extension = getExtension(fullName); byte[] fileBytes = GetFile(fullName); string fileName = ass.DisplayName + "." + extension; return(File( fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); }
public void Scenario_GetAllUserScenarios_Test() { //Arrange IAssignmentDAL assignmentDAO = new AssignmentDAL(ConnectionString); assignmentDAO.AssignScenario(1, 1); IScenarioDAL dao = new ScenarioDAL(ConnectionString); IList <Scenario> testList = new List <Scenario>(); testList = dao.GetAllUserScenarios(1); //Action int result = 1; //Assert Assert.AreEqual(result, testList.Count); }
public static void SaveListStaffsOfGroup(int groupId, List <Assignment> assignments) { // List of staff in group var staffsInGroup = StaffBLL.ListStaffsInGroup(groupId); var staffsInGroupId = staffsInGroup.Select(s => s.Id).ToList(); var removeStaffsList = new List <Assignment>(); foreach (var staffId in staffsInGroupId) { removeStaffsList.Add( new Assignment { StaffId = staffId, GroupId = groupId }); } AssignmentDAL.RemoveRange(removeStaffsList); AssignmentDAL.AddRange(assignments); }
public void Scenario_GetNextScenario_Test() { //Arrange IAssignmentDAL assignmentDAO = new AssignmentDAL(ConnectionString); assignmentDAO.AssignScenario(1, 1); assignmentDAO.AssignScenario(1, 3); IScenarioDAL dao = new ScenarioDAL(ConnectionString); Scenario nextScenario = dao.GetNextScenario(1, 1); //Action int id = 3; //Assert Assert.AreEqual(id, nextScenario.Id); }
public ActionResult DeleteAssignment(AssignmentVM assignment) { AssignmentDAL.DeleteAssignment(Mapper.Map <AssignmentDM>(assignment)); return(View()); }
public ActionResult ReadAssignmentByID(AssignmentDM assignment) { return(View(Mapper.Map <AddressVM>(AssignmentDAL.ReadAssignmentByID(assignment.AssignmentId.ToString())))); }
public ActionResult ReadAssignments() { return(View(Mapper.Map <List <AddressVM> >(AssignmentDAL.ReadAssignments()))); }