Пример #1
0
        public ActionResult PVModel(int?pID)
        {
            ViewBag.LocID     = new SelectList(db.Locations.OrderBy(s => s.LocName), "LocID", "LocName");
            ViewBag.SecID     = new SelectList(ConvertSections(db.ViewSections.OrderBy(s => s.SectionName)), "SectionID", "SectionName");
            ViewBag.DeptID    = new SelectList(ConvertDepartments(db.ViewDepartments.OrderBy(s => s.DeptName)), "DeptID", "DeptName");
            ViewBag.TypeID    = new SelectList(ConvertType(db.ViewEmpTypes.OrderBy(s => s.TypeName)), "TypeID", "TypeName");
            ViewBag.CatID     = new SelectList(db.Categories.OrderBy(s => s.CatName), "CatID", "CatName");
            ViewBag.CompanyID = new SelectList(db.Companies.OrderBy(s => s.CompName), "CompID", "CompName");
            PVModel pvModel = new PVModel();

            pvModel.EmailFormParentID = (int)pID;
            return(View(pvModel));
        }
Пример #2
0
        public ActionResult PVModel(PVModel item)
        {
            EmailFormChild emailFormChild = new EmailFormChild();

            emailFormChild.EmailFormParentID = item.EmailFormParentID;
            emailFormChild.FilterTypeID      = item.FilterTypeID;

            switch (item.FilterTypeID)
            {
            case "Location":
                emailFormChild.FilterValueID = item.LocID;
                break;

            case "Section":
                emailFormChild.FilterValueID = item.SecID;
                break;

            case "Department":
                emailFormChild.FilterValueID = item.DeptID;
                break;

            case "Type":
                emailFormChild.FilterValueID = item.TypeID;
                break;

            case "Category":
                emailFormChild.FilterValueID = item.CatID;
                break;

            case "Company":
                emailFormChild.FilterValueID = item.CompanyID;
                break;

            case "Self":
                emailFormChild.FilterValueID = item.EmpID;
                break;
            }
            db.EmailFormChilds.Add(emailFormChild);
            db.SaveChanges();
            return(RedirectToAction("EmailParent", new { pID = item.EmailFormParentID }));
        }