Exemplo n.º 1
0
        //
        // GET: /DefectDetails/
        public ActionResult Index(int id = 0)
        {
            if (id > 0)
            {
                DefectBusinessLayer defectBL = new DefectBusinessLayer();
                AccountBusinessLayer accountBL = new AccountBusinessLayer();

                Defect defect = defectBL.GetDefect(id);
                List<Comment> defectComments = defectBL.GetDefectComments(defect.id);
                DefectViewModel vmDefect = new DefectViewModel(defect, defectComments);

                ViewData["lstUsers"] = accountBL.GetAllAccounts();
                return View("Defect", vmDefect);
            }
            else
            {
                return RedirectToAction("Index", "DefectList");
            }
        }
Exemplo n.º 2
0
        //
        // GET: /DefectList/
        public ActionResult Index()
        {
            DefectListViewModel defectListViewModel = new DefectListViewModel();
            List<DefectViewModel> lstDefectViewModels = new List<DefectViewModel>();

            DefectBusinessLayer defectBL = new DefectBusinessLayer();

            List<Defect> lstDefects = defectBL.GetAllDefects();

            foreach (Defect defect in lstDefects)
            {
                List<Comment> defectComments = defectBL.GetDefectComments(defect.id);
                DefectViewModel vmDefect = new DefectViewModel(defect, defectComments);
                lstDefectViewModels.Add(vmDefect);
            }

            defectListViewModel.Defects = lstDefectViewModels;

            return View("DefectList", defectListViewModel);
        }