public ActionResult Edit([Bind(Include = "Id,QualityAttributesMetricId,ApplicationId,QualityValue,UserValue,CreationDate,LastUpdated,RowVersion,ApplicationId")] ApplicationEvaluation applicationEvaluation)
 {
     if (ModelState.IsValid)
     {
         _oApplicationEvaluationService.Delete(applicationEvaluation.Id);
         var lstExistingApplicationEvaluations = _oApplicationEvaluationService.GetAll()
                                                 .Where(
             x =>
             x.ApplicationId == applicationEvaluation.ApplicationId &&
             x.QualityAttributesMetricId == applicationEvaluation.QualityAttributesMetricId);
         foreach (var existingApplicationEvaluation in lstExistingApplicationEvaluations)
         {
             _oApplicationEvaluationService.Delete(existingApplicationEvaluation.Id);
         }
         applicationEvaluation.LastUpdated = DateTime.Now;
         applicationEvaluation.Id          = Guid.NewGuid();
         _oApplicationEvaluationService.Add(applicationEvaluation);
         return(Json(new { success = true }));
     }
     ViewBag.SubjectId  = new SelectList(_oSubjectService.GetAll(sort: "Name"), "Id", "Name");
     ViewBag.FactorId   = new SelectList(_oFactorService.GetAll(sort: "Name"), "Id", "Name");
     ViewBag.CriteriaId = new SelectList(_oCriteriaService.GetAll(sort: "Name"), "Id", "Name");
     ViewBag.QualityAttributesMetricId = new SelectList(_oQualityAttributesMetricService.GetAll(sort: "Name"), "Id", "Name", applicationEvaluation.QualityAttributesMetricId);
     return(PartialView(applicationEvaluation));
 }
        // GET: ApplicationEvaluations/Create
        public ActionResult Create(Guid applicationId)
        {
            ApplicationEvaluation applicationEvaluation = new ApplicationEvaluation {
                ApplicationId = applicationId
            };

            ViewBag.SubjectId  = new SelectList(_oSubjectService.GetAll(sort: "Name"), "Id", "Name");
            ViewBag.FactorId   = new SelectList(_oFactorService.GetAll(sort: "Name"), "Id", "Name");
            ViewBag.CriteriaId = new SelectList(_oCriteriaService.GetAll(sort: "Name"), "Id", "Name");

            ViewBag.QualityAttributesMetricId = new SelectList(_oQualityAttributesMetricService.GetAll(sort: "Name").ToList(), "Id", "Name");
            return(PartialView(applicationEvaluation));
        }
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplicationEvaluation applicationEvaluation = _oApplicationEvaluationService.GetById(id.Value);

            if (applicationEvaluation == null)
            {
                return(HttpNotFound());
            }
            return(Json(new { success = true, Message = "" }));
        }
        // GET: ApplicationEvaluations/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplicationEvaluation applicationEvaluation = _oApplicationEvaluationService.GetById(id.Value);

            if (applicationEvaluation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SubjectId  = new SelectList(_oSubjectService.GetAll(sort: "Name"), "Id", "Name");
            ViewBag.FactorId   = new SelectList(_oFactorService.GetAll(sort: "Name"), "Id", "Name");
            ViewBag.CriteriaId = new SelectList(_oCriteriaService.GetAll(sort: "Name"), "Id", "Name");

            ViewBag.QualityAttributesMetricId = new SelectList(_oQualityAttributesMetricService.GetAll(sort: "Name"), "Id", "Name", applicationEvaluation.QualityAttributesMetricId);
            return(PartialView(applicationEvaluation));
        }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "Id,Name,Description,Customer,CreationDate,LastUpdated,RowVersion")] Application application)
        {
            if (ModelState.IsValid)
            {
                application.Id = Guid.NewGuid();
                _oApplicationService.Add(application);
                foreach (var qualityAttributesMetric in _oQualityAttributesMetricService.GetAll())
                {
                    var applicationEvaluation = new ApplicationEvaluation
                    {
                        Id = Guid.NewGuid(),
                        QualityAttributesMetricId = qualityAttributesMetric.Id,
                        ApplicationId             = application.Id,
                        UserValue = qualityAttributesMetric.EvaluationValue
                    };

                    _oApplicationEvaluationService.Add(applicationEvaluation);
                }

                return(RedirectToAction("Edit", new { Id = application.Id }));
            }

            return(View(application));
        }