Ejemplo n.º 1
0
        public async Task <IActionResult> EditPcsScoring(int id, [Bind("PcsScoringId,Score2Target,Score1Lower")] PcsScoring pcsScoring)
        {
            if (id != pcsScoring.PcsScoringId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pcsScoring);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PcsScoringExists(pcsScoring.PcsScoringId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pcsScoring));
        }
Ejemplo n.º 2
0
        private int GetScore(decimal percentage)
        {
            PcsScoring scoreTargets = _pcsScoringRepository.GetScoringParameters();

            if (percentage >= scoreTargets.Score2Target)
            {
                return(2);
            }
            else if (percentage >= scoreTargets.Score1Lower && percentage < scoreTargets.Score2Target)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }