Example #1
0
        //private VestHQDbContext db = new VestHQDbContext();


        // GET: EmployeeSurveyResponse
        public async Task <ActionResult> Index()
        {
            //var employeeSurveyResponses = db.EmployeeSurveyResponses.Include(e => e.Employee).Include(e => e.SurveyQuestion);
            var employeeSurveyResponses = EmployeeSurveyResponseLib.GetAllEmployeeSurveyResponses();

            return(View(await employeeSurveyResponses));
        }
Example #2
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            await EmployeeSurveyResponseLib.DeleteEmployeeSurveyResponse(id);

            //EmployeeSurveyResponse employeeSurveyResponse = await db.EmployeeSurveyResponses.FindAsync(id);
            //db.EmployeeSurveyResponses.Remove(employeeSurveyResponse);
            //await db.SaveChangesAsync();
            return(RedirectToAction("Index"));
        }
Example #3
0
        // GET: EmployeeSurveyResponse/Details/5
        public async Task <ActionResult> Details(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());
            }
            return(View(employeeSurveyResponse));
        }
Example #4
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));
        }
Example #5
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));
        }
Example #6
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));
        }