Esempio n. 1
0
        // GET: Checklists/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            var checklists = db.Checklists.SingleOrDefault(c => c.ChecklistId == id);

            var departments    = db.Departments.ToList();
            var employees      = db.Employees.ToList();
            var checklisttypes = db.ChecklistTypes.ToList();

            var viewModel = new SaveChecklistViewModel()
            {
                Checklist      = checklists,
                Departments    = departments,
                Employees      = employees,
                ChecklistTypes = checklisttypes
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Checklist checklist = await db.Checklists.FindAsync(id);

            if (checklist == null)
            {
                return(HttpNotFound());
            }
            return(View("Edit", viewModel));
            //return View(checklist);
        }
Esempio n. 2
0
        // GET: Checklists/Create
        public ActionResult Create()
        {
            var departments    = db.Departments.ToList();
            var employees      = db.Employees.ToList();
            var checklisttypes = db.ChecklistTypes.ToList();

            var viewModel = new SaveChecklistViewModel()
            {
                Departments    = departments,
                Employees      = employees,
                ChecklistTypes = checklisttypes
            };

            return(View("Create", viewModel));
            //return View();
        }