Пример #1
0
        public ActionResult Create(ComplianceViolation complianceviolation)
        {
            if (ModelState.IsValid)
            {
                _repo.Add(complianceviolation);
                return RedirectToAction("Index");
            }

            ViewBag.IdComplianceCode = new SelectList(_repo.ComplianceCodes, "IdComplianceCode", "NameComplianceCode", complianceviolation.IdComplianceCode);
            ViewBag.IdComplianceReason = new SelectList(_repo.ComplianceReasons, "IdComplianceReason", "NameComplianceReason", complianceviolation.IdComplianceReason);
            ViewBag.IdComplianceResult = new SelectList(_repo.ComplianceResults, "IdComplianceResult", "NameComplianceResult", complianceviolation.IdComplianceResult);
            ViewBag.IdMember = new SelectList(_repo.Members, "IdMember", "MemberNumber", complianceviolation.IdMember);
            return View(complianceviolation);
        }
Пример #2
0
 public void Remove(ComplianceViolation complianceViolation)
 {
     _db.ComplianceViolations.Remove(complianceViolation);
     _db.SaveChanges();
 }
Пример #3
0
 public void Update(ComplianceViolation complianceViolation)
 {
     _db.Entry(complianceViolation).State = EntityState.Modified;
     _db.SaveChanges();
 }
Пример #4
0
 public void Add(ComplianceViolation complianceViolation)
 {
     _db.ComplianceViolations.Add(complianceViolation);
     _db.SaveChanges();
 }