示例#1
0
        public ActionResult AllignStandard(StandardModel returnModel)
        {
            if (ModelState.IsValid)
            {
                foreach (var t in returnModel.StandardIds)
                {
                    var us = new UnitStandard
                        {
                            Unit_Id = returnModel.Id,
                            Standard_Id = t
                        };
                    db.UnitStandards.Add(us);
                }
                db.SaveChanges();
                return RedirectToAction("Details", new { id = returnModel .Id});
            }
            ViewBag.Domains = db.StrandDomains;
            ViewBag.Headers = db.Headers;
            ViewBag.Standards = db.Standards;
            var model = new StandardModel();

            var result = new List<SelectListItem>();
            foreach (var t in db.Standards)
            {
                result.Add(new SelectListItem
                {
                    Text = t.Name,
                    Value = t.Id.ToString()
                });
            }
            model.Standards = result.ToList();
            return View(model);
        }
示例#2
0
        public ActionResult AllignStandard(Guid id)
        {
            ViewBag.Domains = db.StrandDomains;
            ViewBag.Headers = db.Headers;
            ViewBag.Standards = db.Standards;

            var model = new StandardModel();

            var result = new List<SelectListItem>();
            foreach (var t in db.Standards)
            {
                result.Add(new SelectListItem
                {
                    Text = t.Name,
                    Value = t.Id.ToString()
                });
            }
            model.Standards = result.ToList();

            return View(model);
        }