Esempio n. 1
0
        public async Task <IActionResult> TeacherAddCriterion(AddCriterion model)
        {
            if (model.IsValid())
            {
                _criteria = await _context.GetCriteria();

                ResultCriterion criterion = _criteria.FirstOrDefault(u => u.Name == model.Name);
                if (criterion == null)
                {
                    criterion = new ResultCriterion()
                    {
                        Name                        = model.Name,
                        TeacherLogin                = User.Identity.Name,
                        ErrorCost                   = model.ErrorCost,
                        ZipfFactor                  = model.ZipfFactor,
                        ZipfFactorLowerBound        = model.ZipfFactorLowerBound,
                        ZipfFactorUpperBound        = model.ZipfFactorUpperBound,
                        WaterCriterionFactor        = model.WaterCriterionFactor,
                        WaterCriterionLowerBound    = model.WaterCriterionLowerBound,
                        WaterCriterionUpperBound    = model.WaterCriterionUpperBound,
                        KeyWordsCriterionFactor     = model.KeyWordsCriterionFactor,
                        KeyWordsCriterionLowerBound = model.KeyWordsCriterionLowerBound,
                        KeyWordsCriterionUpperBound = model.KeyWordsCriterionUpperBound
                    };
                    await _context.AddCriterion(criterion);
                }
            }

            return(RedirectToAction("TeacherAddCriterion", "StudentTeacher", new { mine = false }));
        }