public IActionResult EditBug(int BugId)
        {
            MyBugEditViewModel myBugEditViewModel = new MyBugEditViewModel();

            IEnumerable <Bug> bugs = BugRepository.GetBug(BugId);
            var bug = bugs.First();

            myBugEditViewModel.bug = bug;


            List <Category> categories = CategoryRepository.GetAllCategory().ToList();

            ViewBag.ListOfCategory      = categories;
            myBugEditViewModel.category = bug.SubCat.Cat;

            List <SubCategory> subCategories = SubCategoryRepository.GetAllSubCategory().ToList();

            subCategories                  = (from subCategory in subCategories where subCategory.CategoryId == bug.SubCat.Cat.CatID select subCategory).ToList();
            ViewBag.ListOfSubCategory      = subCategories;
            myBugEditViewModel.subCategory = bug.SubCat;

            var id = userManager.GetUserId(User);
            IEnumerable <Bug> bugsList = BugRepository.GetAllBugsOfUser(id);

            myBugEditViewModel.bugs = bugsList;
            return(View(myBugEditViewModel));
        }
Exemplo n.º 2
0
        private void PopulateDetails(long bugId)
        {
            var bug = BugRepository.GetBug(bugId);

            if (bug != null)
            {
                FindViewById <TextView>(Resource.Id.expectedBehaviorDetails).Text = bug.ExpectedBehavior;
                FindViewById <TextView>(Resource.Id.observedBehaviorDetails).Text = bug.ObservedBehavior;
                FindViewById <TextView>(Resource.Id.assigned2Details).Text        = bug.Assigned2;
                FindViewById <TextView>(Resource.Id.steps2ReproduceDetails).Text  = bug.Steps2Reproduce;
                FindViewById <TextView>(Resource.Id.priorityDetails).Text         = bug.Priority;
                FindViewById <TextView>(Resource.Id.managerDetails).Text          = bug.FoundBy;
                FindViewById <TextView>(Resource.Id.foundDetails).Text            = bug.Found.ToLongDateString();
            }
        }
        public IActionResult EditBug(int BugId, MyBugEditViewModel myBugEditViewModel)
        {
            if (ModelState.IsValid)
            {
                var SubCategoryID = HttpContext.Request.Form["SubCatId"].ToString();
                if (SubCategoryID == "0")
                {
                    ModelState.AddModelError("", "Select SubCategory");
                    return(View(myBugEditViewModel));
                }

                Bug newBug = myBugEditViewModel.bug;
                newBug.SubCategoryId = Int32.Parse(SubCategoryID);

                BugRepository.UpdateBug(newBug);
                return(RedirectToAction("Index"));
            }
            IEnumerable <Bug> bugs = BugRepository.GetBug(BugId);
            var bug = bugs.First();

            myBugEditViewModel.bug = bug;

            List <Category> categories = CategoryRepository.GetAllCategory().ToList();

            ViewBag.ListOfCategory      = categories;
            myBugEditViewModel.category = bug.SubCat.Cat;

            List <SubCategory> subCategories = SubCategoryRepository.GetAllSubCategory().ToList();

            subCategories                  = (from subCategory in subCategories where subCategory.CategoryId == bug.SubCat.Cat.CatID select subCategory).ToList();
            ViewBag.ListOfSubCategory      = subCategories;
            myBugEditViewModel.subCategory = bug.SubCat;

            var id = userManager.GetUserId(User);
            IEnumerable <Bug> bugsList = BugRepository.GetAllBugsOfUser(id);

            myBugEditViewModel.bugs = bugsList;
            return(View(myBugEditViewModel));
        }