コード例 #1
0
        public ActionResult Save(Factor factor)
        {
            int temp = 0;

            foreach (var fact in _context.Factors.ToList())
            {
                if (factor.FactNum == fact.FactNum)
                {
                    temp = fact.FactNum;
                }
            }

            if (factor.FactNum != temp)
            {
                _context.Factors.Add(factor);
            }
            else
            {
                var factorInDb = _context.Factors.Single(s => s.FactNum == factor.FactNum);
                factorInDb.FactNum     = factor.FactNum;
                factorInDb.Subject_Id  = factor.Subject_Id;
                factorInDb.Description = factor.Description;
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Database"));
        }
コード例 #2
0
        public ActionResult Save(Subject subject)
        {
            int temp = 0;

            foreach (var sub in _context.Subjects.ToList())
            {
                if (subject.ID == sub.ID)
                {
                    temp = sub.ID;
                }
            }

            if (subject.ID != temp)
            {
                _context.Subjects.Add(subject);
            }
            else
            {
                var subjectInDb = _context.Subjects.Single(s => s.ID == subject.ID);
                //subjectInDb.ID = subject.ID;
                subjectInDb.Description = subject.Description;
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Database"));
        }
コード例 #3
0
ファイル: CriteriaController.cs プロジェクト: moKelani/WhatzQ
        public ActionResult Save(Criterion criterion)
        {
            int temp = 0;

            foreach (var crit in _context.Criteria.ToList())
            {
                if (criterion.CriteriaNum == crit.CriteriaNum)
                {
                    temp = crit.CriteriaNum;
                }
            }

            if (criterion.CriteriaNum != temp)
            {
                _context.Criteria.Add(criterion);
            }
            else
            {
                var criterionInDb = _context.Criteria.Single(s => s.CriteriaNum == criterion.CriteriaNum);
                criterionInDb.CriteriaNum = criterion.CriteriaNum;
                criterionInDb.Factor_Id   = criterion.Factor_Id;
                criterionInDb.Subject_Id  = criterion.Subject_Id;
                criterionInDb.Description = criterion.Description;
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Database"));
        }
コード例 #4
0
        public ActionResult Save(Application application)
        {
            int temp = 0;

            foreach (var app in _context.Applications.ToList())
            {
                if (application.AppID == app.AppID)
                {
                    temp = app.AppID;
                }
            }

            if (application.AppID != temp)
            {
                _context.Applications.Add(application);
            }
            else
            {
                var applicationInDb = _context.Applications.Single(s => s.AppID == application.AppID);
                applicationInDb.AppID     = application.AppID;
                applicationInDb.SubjectID = application.SubjectID;
                applicationInDb.FNum      = application.FNum;
                applicationInDb.CNum      = application.CNum;
                applicationInDb.MNum      = application.MNum;
                applicationInDb.QValue    = application.QValue;
                applicationInDb.UsesValue = application.UsesValue;
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Database"));
        }
コード例 #5
0
        public ActionResult Save(QualityMetric qualityMetric)
        {
            int temp = 0;

            foreach (var qmetric in _context.QualityMetrics.ToList())
            {
                if (qualityMetric.MetricNum == qmetric.MetricNum)
                {
                    temp = qmetric.MetricNum;
                }
            }

            if (qualityMetric.MetricNum != temp)
            {
                _context.QualityMetrics.Add(qualityMetric);
            }
            else
            {
                var qmterInDb = _context.QualityMetrics.Single(s => s.MetricNum == qualityMetric.MetricNum);
                qmterInDb.MetricNum           = qualityMetric.MetricNum;
                qmterInDb.Criteria_Id         = qualityMetric.Criteria_Id;
                qmterInDb.Factor_Id           = qualityMetric.Factor_Id;
                qmterInDb.Subject_Id          = qualityMetric.Subject_Id;
                qmterInDb.Description         = qualityMetric.Description;
                qmterInDb.TypeofMetric        = qualityMetric.TypeofMetric;
                qmterInDb.TypesofValue        = qualityMetric.TypesofValue;
                qmterInDb.TypeofQualifiration = qualityMetric.TypeofQualifiration;
                qmterInDb.RelationofMetric    = qualityMetric.RelationofMetric;
                qmterInDb.RatedBased          = qualityMetric.RatedBased;
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Database"));
        }