public ActionResult EditDefect(Defect defect, string BtnSubmit)
        {
            if (ModelState.IsValid)
            {
                DefectBusinessLayer defectBL = new DefectBusinessLayer();
                defectBL.EditDefect(defect);
                return RedirectToAction("Index", "Defect", new { id = defect.id });
            }

            return new EmptyResult();
        }
 //
 // GET: /DefectDetails/
 public ActionResult SaveComment(Comment comment, string BtnSubmit)
 {
     switch (BtnSubmit)
     {
         case "Save Comment":
             DefectBusinessLayer defectBL = new DefectBusinessLayer();
             defectBL.SaveComment(comment);
             return RedirectToAction("Index", "Defect", new { id = comment.defectId });
     }
     return new EmptyResult();
 }
 public ActionResult SaveDefect(Defect defect, string BtnSubmit)
 {
     switch (BtnSubmit)
     {
         case "Save Defect":
             DefectBusinessLayer defectBL = new DefectBusinessLayer();
             defectBL.SaveDefect(defect);
             return RedirectToAction("Index", "Defect", new { id = defect.id });
         case "Cancel":
             return RedirectToAction("Index");
     }
     return new EmptyResult();
 }
        //
        // 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");
            }
        }
        //
        // 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);
        }