public ActionResult EditEmployeeTraining(EmployeeTrainingView employeeTrainingView) { if (employeeTrainingView == null) { throw new ArgumentNullException(nameof(employeeTrainingView)); } if (!ModelState.IsValid) { var returnModel = this.employeeTrainingService.GetCreateEmployeeTraining(employeeTrainingView, string.Empty); return(this.View("EditEmployeeTraining", returnModel)); } var processmessage = employeeTrainingService.ProcessEditEmployeeTraining(employeeTrainingView); if (!string.IsNullOrEmpty(processmessage)) { var returnModel = this.employeeTrainingService.GetCreateEmployeeTraining(employeeTrainingView, processmessage); return(this.View("EditEmployeeTraining", returnModel)); } processmessage = string.Format("Employee Training Updated"); return(Redirect(employeeTrainingView.URL)); }
public ActionResult CreateEmployeeTraining(EmployeeTrainingView epmloyeeTrainingView, TrainingView trainingView) { if (epmloyeeTrainingView == null) { throw new ArgumentNullException(nameof(epmloyeeTrainingView)); } if (!ModelState.IsValid) { var returnModel = this.employeeTrainingService.GetCreateEmployeeTraining(epmloyeeTrainingView, string.Empty); return(this.View("CreateEmployeeTraining", returnModel)); } var ProcessingMessage = employeeTrainingService.SaveEmployeeTraining(epmloyeeTrainingView, trainingView); if (!string.IsNullOrEmpty(ProcessingMessage)) { var returnModel = this.employeeTrainingService.GetCreateEmployeeTraining(epmloyeeTrainingView, ProcessingMessage); return(this.View("CreateEmployeeTraining", returnModel)); } ProcessingMessage = string.Format("Employee Applied for Training"); return(RedirectToAction("EmployeeTrainingList", new { ProcessingMessage })); }
/// <summary> /// Creates the employee training view. /// </summary> /// <param name="employeeTrainingModel">The employee training model.</param> /// <param name="companyInfo">The company information.</param> /// <param name="training">The training.</param> /// <param name="employee">The employee.</param> /// <param name="trainingReport">The training report.</param> /// <returns></returns> public IEmployeeTrainingView CreateEmployeeTrainingView(IList <IEmployeeTrainingModel> employeeTrainingModel, ICompanyDetail companyInfo, IList <ITraining> training, IList <IEmployee> employee, IList <ITrainingReport> trainingReport) { var TrainingDDL = GetDropDownList.TrainingListItems(training, -1); var EmployeeDDL = GetDropDownList.EmployeeListitems(employee, -1); var model = new EmployeeTrainingView { TrainingDropDownList = TrainingDDL, EmployeeDropDownList = EmployeeDDL, ProcessingMessage = string.Empty, CompanyId = companyInfo.CompanyId }; return(model); }
/// <summary> /// Creates the edit employee training view. /// </summary> /// <param name="employeeTrainingModel">The employee training model.</param> /// <param name="companyInfo">The company information.</param> /// <param name="employeeCollection">The employee collection.</param> /// <param name="trainingCollection">The training collection.</param> /// <returns></returns> /// <exception cref="ArgumentNullException"> /// employeeTrainingModel /// or /// companyCollecction /// or /// trainingCollection /// or /// companyCollecction /// </exception> public IEmployeeTrainingView CreateEditEmployeeTrainingView(IEmployeeTrainingModel employeeTrainingModel, ICompanyDetail companyInfo, IList <IEmployee> employeeCollection, IList <ITraining> trainingCollection) { if (employeeTrainingModel == null) { throw new ArgumentNullException(nameof(employeeTrainingModel)); } if (trainingCollection == null) { throw new ArgumentNullException(nameof(trainingCollection)); } if (employeeCollection == null) { throw new ArgumentNullException(nameof(employeeCollection)); } var trainingDDL = GetDropDownList.TrainingListItems(trainingCollection, employeeTrainingModel.TrainingId); var employeeDDL = GetDropDownList.EmployeeListitems(employeeCollection, employeeTrainingModel.EmployeeId); var viewModel = new EmployeeTrainingView { EmployeeTrainingId = employeeTrainingModel.EmployeeTrainingId, TrainingId = employeeTrainingModel.TrainingId, SupervisorId = employeeTrainingModel.SupervisorId, EmployeeId = employeeTrainingModel.EmployeeId, DateApproved = employeeTrainingModel.DateApproved, CompanyId = employeeTrainingModel.CompanyId, DateCreated = employeeTrainingModel.DateCreated, EmployeeDropDownList = employeeDDL, TrainingDropDownList = trainingDDL, ProcessingMessage = string.Empty, }; return(viewModel); }