Esempio n. 1
0
        // GET: EmployeeSurveyResponse/Create
        public async Task <ActionResult> Create()
        {
            var employees = await EmployeerLib.GetAllEmployees();

            var surveyQuestions = await SurveyQuestionLib.GetAllSurveyQuestions();

            ViewBag.EmployeeId       = new SelectList(employees, "Id", "FullName");
            ViewBag.SurveyQuestionId = new SelectList(surveyQuestions, "Id", "Text");

            //ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName");
            //ViewBag.SurveyQuestionId = new SelectList(db.SurveyQuestions, "Id", "Text");
            return(View());
        }
Esempio n. 2
0
        public async Task <ActionResult> Create([Bind(Include = "Id,EmployeeId,SurveyQuestionId,Answer")] EmployeeSurveyResponse employeeSurveyResponse)
        {
            if (ModelState.IsValid)
            {
                await EmployeeSurveyResponseLib.InsertEmployeeSurveyResponse(employeeSurveyResponse);

                //db.EmployeeSurveyResponses.Add(employeeSurveyResponse);
                //await db.SaveChangesAsync();
                return(RedirectToAction("Index"));
            }

            var employees = await EmployeerLib.GetAllEmployees();

            var surveyQuestions = await SurveyQuestionLib.GetAllSurveyQuestions();

            ViewBag.EmployeeId       = new SelectList(employees, "Id", "FullName", employeeSurveyResponse.EmployeeId);
            ViewBag.SurveyQuestionId = new SelectList(surveyQuestions, "Id", "Text", employeeSurveyResponse.SurveyQuestionId);
            return(View(employeeSurveyResponse));
        }
Esempio n. 3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,EmployeeId,SurveyQuestionId,Answer")] EmployeeSurveyResponse employeeSurveyResponse)
        {
            if (ModelState.IsValid)
            {
                await EmployeeSurveyResponseLib.UpdateEmployeeSurveyResponse(employeeSurveyResponse);

                //db.Entry(employeeSurveyResponse).State = EntityState.Modified;
                //await db.SaveChangesAsync();
                return(RedirectToAction("Index"));
            }
            var employees = await EmployeerLib.GetAllEmployees();

            var surveyQuestions = await SurveyQuestionLib.GetAllSurveyQuestions();

            ViewBag.EmployeeId       = new SelectList(employees, "Id", "FirstName", employeeSurveyResponse.EmployeeId);
            ViewBag.SurveyQuestionId = new SelectList(surveyQuestions, "Id", "Text", employeeSurveyResponse.SurveyQuestionId);
            //ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", employeeSurveyResponse.EmployeeId);
            //ViewBag.SurveyQuestionId = new SelectList(db.SurveyQuestions, "Id", "Text", employeeSurveyResponse.SurveyQuestionId);
            return(View(employeeSurveyResponse));
        }
Esempio n. 4
0
        // GET: EmployeeSurveyResponse/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeSurveyResponse employeeSurveyResponse = await EmployeeSurveyResponseLib.GetEmployeeSurveyResponse(id);

            //EmployeeSurveyResponse employeeSurveyResponse = await db.EmployeeSurveyResponses.FindAsync(id);
            if (employeeSurveyResponse == null)
            {
                return(HttpNotFound());
            }
            var employees = await EmployeerLib.GetAllEmployees();

            var surveyQuestions = await SurveyQuestionLib.GetAllSurveyQuestions();

            ViewBag.EmployeeId       = new SelectList(employees, "Id", "FullName", employeeSurveyResponse.EmployeeId);
            ViewBag.SurveyQuestionId = new SelectList(surveyQuestions, "Id", "Text", employeeSurveyResponse.SurveyQuestionId);

            //ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", employeeSurveyResponse.EmployeeId);
            //ViewBag.SurveyQuestionId = new SelectList(db.SurveyQuestions, "Id", "Text", employeeSurveyResponse.SurveyQuestionId);
            return(View(employeeSurveyResponse));
        }