Example #1
0
        public bool CreateTeamMetric(TeamMetricCreate model)
        {
            var entity =
                new TeamMetric()
            {
                OwnerId             = _userId,
                TeamId              = model.TeamId,
                Team                = model.TeamId,
                ScrumMasterId       = model.ScrumMasterId,
                ScrumMaster         = model.ScrumMasterId,
                Fiscalyear          = model.Fiscalyear,
                FiscalQuarter       = (Data.Quarter)model.FiscalQuarter,
                BurnUp              = model.BurnUp,
                Velocity            = model.Velocity,
                ProdSupport         = model.ProdSupport,
                CustomerRating      = model.CustomerRating,
                TrustRating         = model.TrustRating,
                RatingOfPerformance = (Data.PerformanceRating)model.RatingOfPerformance
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.TeamMetrics.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Create(TeamMetricCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateTeamMetricService();

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

            ModelState.AddModelError("", "Your evaluation coudl not be created.");

            return(View(model));
        }