コード例 #1
0
        public bool UpdateTeamMetric(TeamMetricEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .TeamMetrics
                    .Single(e => e.EvalId == model.EvalId && e.OwnerId == _userId);


                entity.TeamId              = model.TeamId;
                entity.Team                = model.TeamId;
                entity.ScrumMasterId       = model.ScrumMasterId;
                entity.ScrumMaster         = model.ScrumMasterId;
                entity.Fiscalyear          = model.Fiscalyear;
                entity.FiscalQuarter       = (Data.Quarter)model.FiscalQuarter;
                entity.BurnUp              = model.BurnUp;
                entity.Velocity            = model.Velocity;
                entity.ProdSupport         = model.ProdSupport;
                entity.CustomerRating      = model.CustomerRating;
                entity.TrustRating         = model.TrustRating;
                entity.RatingOfPerformance = (Data.PerformanceRating)model.RatingOfPerformance;

                return(ctx.SaveChanges() == 1);
            }
        }
コード例 #2
0
        // GET: TeamMetric/Edit
        public ActionResult Edit(int id)
        {
            var service = CreateTeamMetricService();
            var detail  = service.GetTeamMetricById(id);

            var userId   = Guid.Parse(User.Identity.GetUserId());
            var service2 = new ScrumTeamService(userId);
            var service3 = new ScrumMasterService(userId);

            List <ScrumTeam> scrumTeams = service2.GetScrumTeamList().ToList();

            var query = from c in scrumTeams
                        select new SelectListItem()
            {
                Value = c.TeamId.ToString(),
                Text  = c.TeamName
            };

            List <ScrumMaster> scrumMasters = service3.GetScrumMasterList().ToList();

            var query2 = from c in scrumMasters
                         select new SelectListItem()
            {
                Value = c.ScrumMasterId.ToString(),
                Text  = c.FirstName + c.LastName
            };


            var model =
                new TeamMetricEdit
            {
                EvalId              = detail.EvalId,
                TeamId              = detail.TeamId,
                ScrumMasterId       = detail.ScrumMasterId,
                Fiscalyear          = detail.Fiscalyear,
                FiscalQuarter       = detail.FiscalQuarter,
                Velocity            = detail.Velocity,
                BurnUp              = detail.BurnUp,
                ProdSupport         = detail.ProdSupport,
                CustomerRating      = detail.CustomerRating,
                RatingOfPerformance = detail.RatingOfPerformance
            };

            ViewBag.TeamId        = query;
            ViewBag.ScrumMasterId = query2;

            return(View(model));
        }
コード例 #3
0
        public ActionResult Edit(int id, TeamMetricEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.EvalId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = CreateTeamMetricService();

            if (service.UpdateTeamMetric(model))
            {
                TempData["SaveResult"] = "Your evaluation was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your evaluation could not be updated.");
            return(View(model));
        }