// // GET: /SysAdmin/Employee/k public ActionResult Index() { List <EmployeeVM> viewModels = new List <EmployeeVM>(); EmployeeBAL balObject = new EmployeeBAL(); IQueryable <Entities.Employee> entites = balObject.GetAll(SessionHelper.SchoolId); foreach (Entities.Employee entity in entites) { EmployeeVM viewModel = new EmployeeVM(); viewModel.EmployeeId = entity.EmployeeId; viewModel.EmployeeCode = entity.EmployeeCode; viewModel.Password = entity.Password; viewModel.FirstName = entity.FirstName; viewModel.MiddleName = entity.MiddleName; viewModel.LastName = entity.LastName; viewModel.Category = entity.Category; viewModel.Address = entity.Address; viewModel.ContactNo = entity.ContactNo; viewModel.DOB = entity.DOB; viewModel.JoiningDate = entity.JoiningDate; viewModels.Add(viewModel); } return(View(new GridModel <EmployeeVM> { Data = viewModels })); }
public ActionResult LeaveReport(FormCollection frm) { EmployeeLeaveApplyVM viewModel = new EmployeeLeaveApplyVM(); if (frm["EmployeeId"] != null && !string.IsNullOrEmpty(frm["EmployeeId"])) { viewModel.EmployeeId = Convert.ToInt32(frm["EmployeeId"]); } if (ModelState.IsValid) { PresentationLayer.Helpers.SessionHelper.ReportIndex = 5; PresentationLayer.Helpers.SessionHelper.TempId = viewModel.EmployeeId; return(Redirect(@"~\Report.aspx")); } else { EmployeeBAL employeeBAL = new EmployeeBAL(); viewModel.EmployeeList = from obj in employeeBAL.GetAll() select new SelectListItem() { Text = obj.FirstName.Trim() + " " + obj.MiddleName.Trim() + " " + obj.LastName.Trim(), Value = obj.EmployeeId.ToString() }; return(View(viewModel)); } }
public ActionResult EmployeeLeaveApply() { EmployeeBAL employeeBAL = new EmployeeBAL(); EmployeeLeaveApplyVM viewModel = new EmployeeLeaveApplyVM(); viewModel.EmployeeList = from obj in employeeBAL.GetAll() select new SelectListItem() { Text = obj.FirstName.Trim() + " " + obj.MiddleName.Trim() + " " + obj.LastName.Trim(), Value = obj.EmployeeId.ToString() }; return(View(viewModel)); }
public IActionResult GetAll() { // List<Department> department = new List<Department>(); IEnumerable <Employee> employee = employeeBAL.GetAll(); if (employee != null) { return(Ok(new { success = true, response = employee })); } else { return(Ok(new { success = false, response = "Data Not Found" })); } }
public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <EmployeeVM> viewModels = new List <EmployeeVM>(); EmployeeBAL balObject = new EmployeeBAL(); IQueryable <Entities.Employee> entites = balObject.GetAll(); foreach (Entities.Employee entity in entites) { EmployeeVM viewModel = new EmployeeVM(); viewModel.EmployeeId = entity.EmployeeId; viewModel.EmployeeCode = entity.EmployeeCode; viewModel.Password = entity.Password; viewModel.FirstName = entity.FirstName; viewModel.MiddleName = entity.MiddleName; viewModel.LastName = entity.LastName; viewModel.Category = entity.Category; viewModel.Address = entity.Address; viewModel.ContactNo = entity.ContactNo; viewModel.DOB = entity.DOB; viewModel.JoiningDate = entity.JoiningDate; viewModels.Add(viewModel); } return(View(new GridModel <EmployeeVM> { Data = viewModels })); } }