Esempio n. 1
0
        public ActionResult Create(CreateBugViewModel bug, string returnAction)
        {
            if (ModelState.IsValid)
            {
                BugDAL.AddBug(
                    bug.TesterId,
                    bug.ProjectId,
                    bug.Priority,
                    bug.Status,
                    bug.DiscoverDate,
                    bug.Description);

                InfoCardDAL.AddBugToInfoCard(bug.TesterId, bug.ProjectId);

                return RedirectToAction( returnAction);
            }

            List<ProjectViewModel> projects = new List<ProjectViewModel>();
            foreach (var item in ProjectDAL.ListAllProjects())
            {
                projects.Add(new ProjectViewModel(item));
            }
            ViewBag.ProjectId = new SelectList(projects, "ProjectId", "ProjectName", bug.ProjectId);

            ViewBag.PriorityList = new SelectList(PriorityList);
            //ViewBag.UserId = new SelectList(UserProfileDAL.ListAllUserProfiles(), "UserId", "UserName", bug.TesterId);
            return View(bug);
        }
Esempio n. 2
0
        //
        // GET: /Bug/Create
        public ActionResult Create(string returnAction)
        {
            ViewBag.ReturnAction = returnAction;

            List<ProjectViewModel> projects = new List<ProjectViewModel>();
            foreach (var item in ProjectDAL.ListAllProjects())
            {
                projects.Add(new ProjectViewModel(item));
            }
            ViewBag.ProjectId = new SelectList(projects, "ProjectId", "ProjectName");

            ViewBag.PriorityList = new SelectList(PriorityList);
            //List<UserProfileViewModel> testers = new List<UserProfileViewModel>();
            //foreach (var item in UserProfileDAL.ListAllUserProfiles())
            //{
            //    testers.Add(new UserProfileViewModel(item));
            //}
            //ViewBag.UserId = new SelectList(testers, "UserId", "UserName");

            CreateBugViewModel bug = new CreateBugViewModel();
            return View(bug);
        }