public async Task <IActionResult> Apply(long id) { //Get current user details var user = await _lookUpService.GetCurrentLoggedInUser(User.Identity.Name); //Get currect leaner details var learner = await _lookUpService.GetLearnerDetailsByIdEmail(user.Email); if (ModelState.IsValid) { //Prepare and application var jobApplications = new JobApplications { ApplicationStatus = Const.PENDINNG_STATUS, DateApplied = DateTime.Now, LearnerId = learner.LearnerId, JobId = id, }; var lnr = _context.Learner.FirstOrDefault(l => l.LearnerId == learner.LearnerId); lnr.AppliedYn = Const.TRUE; await SendAcknowledgementMail(learner); _context.Update(lnr); _context.Add(jobApplications); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction("Details", "Person", new { id = learner.NationalID })); }
public async Task <IActionResult> Create([Bind("LearnerCourseId,LearnerId,InstitutionName,CourseName,DateOfCompletion,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] LearnerCourse learnerCourse) { //Get current user details var user = await _lookUpService.GetCurrentLoggedInUser(User.Identity.Name); //Get current leaner details var learner = await _lookUpService.GetLearnerDetailsByIdEmail(user.Email); if (ModelState.IsValid) { //assign Leaner Id to link these qualifications to leaner learnerCourse.LearnerId = learner.LearnerId; //create an audit trail learnerCourse.CreatedBy = user.UserName; learnerCourse.DateCreated = DateTime.Now; learnerCourse.LastUpdatedBy = user.UserName; learnerCourse.DateUpdated = DateTime.Now; _context.Add(learnerCourse); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "Person", new { id = learner.NationalID })); } return(RedirectToAction("Details", "Person", new { id = learner.NationalID })); }
public async Task <IActionResult> Create([Bind("JobId,JobCode,JobTitle,JobDesc,JobTypeId,OfoId,JobSectorId,SectorId,ProvinceId,ListedDate,ExpiryDate,JobPhoto,JobPhotoPath,JobPhotoName")] Job job) { if (ModelState.IsValid) { var jobPhotoPath = "/Images/" + System.Guid.NewGuid().ToString().Substring(0, 10) + "/"; if (!Directory.Exists(_env.WebRootPath + jobPhotoPath)) { Directory.CreateDirectory(_env.WebRootPath + jobPhotoPath); } SingleFile(_env.WebRootPath + jobPhotoPath, job.JobPhoto); job.JobPhotoName = job.JobPhoto.FileName; job.JobPhotoPath = jobPhotoPath; Console.WriteLine(" FILE NAME : " + job.JobPhoto.FileName); _context.Add(job); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["JobTypeId"] = new SelectList(_context.JobType, "JobTypeId", "JobTypeDesc", job.JobTypeId); ViewData["JobSectorId"] = new SelectList(_context.JobSector, "JobSectorId", "JobSectorDesc", job.JobSectorId); ViewData["SectorId"] = new SelectList(_context.Sector, "SectorId", "SectorDesc", job.SectorId); ViewData["OfoId"] = new SelectList(_context.Ofo, "OfoId", "OfoTitle", job.JobSectorId); ViewData["ProvinceId"] = new SelectList(_context.Province, "ProvinceId", "ProvinceName", job.ProvinceId); return(PartialView(job)); }
public async Task<IActionResult> Create([Bind("Id,FirstName,LastName,Email,PhoneNumber,PersonsDob,GenderId,NationalId,EquityId,NationalityId,HomeLanguageId,CitizenshipStatusId,DisabilityStatusId,UserId,PhotoPath,PhotoName,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } ViewData["CitizenshipStatusId"] = new SelectList(_context.CitizenshipStatus, "CitizenshipStatusId", "CitizenshipStatusId", person.CitizenshipStatusId); ViewData["DisabilityStatusId"] = new SelectList(_context.DisabilityStatus, "DisabilityStatusId", "DisabilityStatusId", person.DisabilityStatusId); ViewData["EquityId"] = new SelectList(_context.Equity, "EquityId", "EquityId", person.EquityId); ViewData["GenderId"] = new SelectList(_context.Gender, "GenderId", "GenderId", person.GenderId); ViewData["HomeLanguageId"] = new SelectList(_context.HomeLanguage, "HomeLanguageId", "HomeLanguageId", person.HomeLanguageId); ViewData["NationalityId"] = new SelectList(_context.Nationality, "NationalityId", "NationalityId", person.NationalityId); return View(person); }
public async Task <IActionResult> CreateCompany([Bind("Company", "Address", "Photo")] CompanyViewModel companyViewModel) { if (ModelState.IsValid) { // This Uploads learner profile image var photoPath = _fconfig.Images + companyViewModel.Company.CompanyRegistrationNo + "/" + Utils.GenerateImageFolderId() + "/"; if (companyViewModel.Photo != null) { _fileService.UploadFile(companyViewModel.Photo, _env.WebRootPath + photoPath); companyViewModel.Company.PhotoName = companyViewModel.Photo.FileName; companyViewModel.Company.PhotoPath = photoPath; Console.WriteLine(" FILE NAME : " + companyViewModel.Photo.FileName); } companyViewModel.Company.CreatedBy = User.Identity.Name; companyViewModel.Company.DateCreated = DateTime.Now; companyViewModel.Company.LastUpdatedBy = User.Identity.Name; companyViewModel.Company.DateUpdated = DateTime.Now; companyViewModel.Address.CreatedBy = User.Identity.Name; companyViewModel.Address.DateCreated = DateTime.Now; companyViewModel.Address.LastUpdatedBy = User.Identity.Name; companyViewModel.Address.DateUpdated = DateTime.Now; companyViewModel.Company.Address.Add(companyViewModel.Address); //Add company to the database _context.Add(companyViewModel.Company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "CityId", "CityName", companyViewModel.Address.CityId); ViewData["SuburbId"] = new SelectList(_context.Suburb, "SuburbId", "SuburbName", companyViewModel.Address.SuburbId); ViewData["CountryId"] = new SelectList(_context.Country, "CountryId", "CountryName", companyViewModel.Address.CountryId); ViewData["ProvinceId"] = new SelectList(_context.Province, "ProvinceId", "ProvinceName", companyViewModel.Address.ProvinceId); ViewData["AddressTypeId"] = new SelectList(_context.AddressType, "AddressTypeId", "AddressTypeName", companyViewModel.Address.AddressTypeId); return(View(companyViewModel)); }
public async Task <IActionResult> Create([Bind("Id,FilePath,FileName,DocumentTypeId,Comments,MyFiles,LearnerId,CompanyId,Verified,VerificationDate,VerifiedBy,JobApplicationId,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Document document) { if (ModelState.IsValid) { //Get current user details var user = await _lookUpService.GetCurrentLoggedInUser(User.Identity.Name); //Get current leaner details var learner = await _lookUpService.GetLearnerDetailsByIdEmail(user.Person.NationalId); //assign Leaner Id to link these qualifications to leaner document.LearnerId = learner.LearnerId; document.FileName = document.MyFiles.FileName; if (document.DocumentTypeId != null) { document.FilePath = _foldersConfigation.Documents + learner.NationalID + "/" + (_lookUpService.GetAllDocumentTypesById(document.DocumentTypeId).Result .TypeName); } _fileService.UploadFile(document.MyFiles, document.FilePath); //create an audit trail document.CreatedBy = user.UserName; document.DateCreated = DateTime.Now.Date; document.LastUpdatedBy = user.UserName; document.DateUpdated = DateTime.Now.Date; document.Verified = "false"; document.FilePath = _foldersConfigation.Documents + learner.NationalID + "/" + (_lookUpService.GetAllDocumentTypesById(document.DocumentTypeId).Result .TypeName) + "/"; _context.Add(document); await _context.SaveChangesAsync(); _notyf.Success("Document created successfully...."); return(RedirectToAction("Details", "Person", new { id = learner.NationalID })); } return(PartialView(document)); }
public async Task <IActionResult> Create([Bind("DashboardId,Name,Status,Type,Department")] Dashboard dashboard) { if (ModelState.IsValid) { _context.Add(dashboard); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(dashboard)); }
public async Task <IActionResult> Create([Bind("CountryId,CountryName,CountryCode,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(country)); }
public async Task <IActionResult> Create([Bind("SectorId,SectorDesc,ActiveYn")] Sector sector) { if (!ModelState.IsValid) { return(PartialView(sector)); } _context.Add(sector); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("InstitutionTypeId,InstitutionTypeDesc,InstitutionTypeCode")] InstitutionType institutionType) { if (ModelState.IsValid) { _context.Add(institutionType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(institutionType)); }
public async Task <IActionResult> Create([Bind("FinancialyearId,StartDate,EndDate,ActiveForWsp,FinancialyearDesc,LockedForWspSubmission,ActiveYn")] Financialyear financialyear) { if (ModelState.IsValid) { _context.Add(financialyear); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(financialyear)); }
public async Task <IActionResult> Create([Bind("CourseId,CourseCode,CourseTitle,CourseDesc,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(course)); }
public async Task <IActionResult> Create([Bind("SchoolId,SchoolName,SchoolCode,EmisNo")] School school) { if (ModelState.IsValid) { _context.Add(school); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(school)); }
public async Task <IActionResult> Create([Bind("SuburbId,SuburbName,SuburbCode,CityId,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Suburb suburb) { if (ModelState.IsValid) { _context.Add(suburb); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "CityId", "CityName", suburb.CityId); return(PartialView(suburb)); }
public async Task <IActionResult> Create([Bind("ProvinceId,ProvinceName,ProvinceCode,CountryId,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Province province) { if (ModelState.IsValid) { _context.Add(province); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "CountryId", "CountryName", province.CountryId); return(PartialView(province)); }
public async Task <IActionResult> Create([Bind("OfoMinorId,OfoMinorCode,OfoMinorTitle,OfoSubMajorId,FinancialYearId")] OfoMinor ofoMinor) { if (ModelState.IsValid) { _context.Add(ofoMinor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofoMinor.FinancialYearId); return(PartialView(ofoMinor)); }
public async Task <IActionResult> Create([Bind("InstitutionId,InstitutionName,InstitutionCode,InstitutionTypeId")] Institution institution) { if (ModelState.IsValid) { _context.Add(institution); await _context.SaveChangesAsync(); Alert("Institution created successfully...", learner_portal.Helpers.Enum.NotificationType.success); return(RedirectToAction(nameof(Index))); } ViewData["InstitutionTypeId"] = new SelectList(_context.InstitutionType, "InstitutionTypeId", "InstitutionTypeDesc", institution.InstitutionTypeId); return(PartialView(institution)); }
public async Task <IActionResult> Create([Bind("OfoId,OfoCode,OfoTitle,OfoUnitId,FinancialYearId")] Ofo ofo) { if (ModelState.IsValid) { _context.Add(ofo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofo.FinancialYearId); ViewData["OfoUnitId"] = new SelectList(_context.OfoUnit, "OfoUnitId", "OfoUnitTitle", ofo.OfoUnitId); return(PartialView(ofo)); }
public async Task <IActionResult> Create([Bind("Person", "Address", "Assessor")] AssessorViewModel assessorViewModel) { if (ModelState.IsValid) { var user = await _lookUpService.GetCurrentLoggedInUser(User.Identity.Name); assessorViewModel.Assessor.CreatedBy = user.UserName; assessorViewModel.Assessor.DateCreated = DateTime.Now; assessorViewModel.Assessor.ApplicationDate = DateTime.Now; //Link the Address to the Person assessorViewModel.Person.Address.Add(assessorViewModel.Address); // Add the Person into the Database var member = await _lookUpService.GetUserByUsrname(User.Identity.Name); assessorViewModel.Person.UserId = member.Id; assessorViewModel.Person.Email = member.Email; //Now link the Assessor to this Person Profile created assessorViewModel.Assessor.Person = assessorViewModel.Person; //Now link the learner to this Person Profile created assessorViewModel.Learner.Person = assessorViewModel.Person; //Then Add the Learner to the Database _context.Add(assessorViewModel.Learner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AccreditationStatusId"] = new SelectList(_context.AccreditationStatuses, "AccreditationStatusId", "AccreditationStatusDesc", assessorViewModel.Assessor.AccreditationStatusesId); ViewData["EtqeId"] = new SelectList(_context.Etqe, "EtqeId", "EtqeName", assessorViewModel.Assessor.EtqeId); ViewData["ApplicationTypesId"] = new SelectList(_context.ApplicationType, "ApplicationTypesId", "ApplicationTypesDesc", assessorViewModel.Assessor.ApplicationTypes); ViewData["EvaluatorsId"] = new SelectList(_context.Evaluator, "EvaluatorsId", "EvaluatorsId", assessorViewModel.Assessor.Evaluators); ViewData["CitizenshipStatusId"] = new SelectList(_context.CitizenshipStatus, "CitizenshipStatusId", "CitizenshipStatusDesc", assessorViewModel.Person.CitizenshipStatus); ViewData["DisabilityStatusId"] = new SelectList(_context.DisabilityStatus, "DisabilityStatusId", "DisabilityStatusDesc", assessorViewModel.Person.DisabilityStatus); ViewData["EquityId"] = new SelectList(_context.Equity, "EquityId", "EquityDesc", assessorViewModel.Person.Equity); ViewData["GenderId"] = new SelectList(_context.Gender, "GenderId", "GenderDesc", assessorViewModel.Person.Gender); ViewData["HomeLanguageId"] = new SelectList(_context.HomeLanguage, "HomeLanguageId", "HomeLanguageDesc", assessorViewModel.Person.HomeLanguage); ViewData["QualificationId"] = new SelectList(_context.Qualification, "QualificationId", "QualificationTitle", assessorViewModel.Qualification.QualificationId); ViewData["NationalityId"] = new SelectList(_context.Nationality, "NationalityId", "NationalityDesc", assessorViewModel.Person.Nationality); ViewData["CityId"] = new SelectList(await _lookUpService.GetCities(), "id", "name", assessorViewModel.Address.City); ViewData["SuburbId"] = new SelectList(_lookUpService.GetSuburbs().Result, "id", "name", assessorViewModel.Address.Suburb); ViewData["CountryId"] = new SelectList(_lookUpService.GetCountries().Result, "id", "name", assessorViewModel.Address.Country); ViewData["ProvinceId"] = new SelectList(_lookUpService.GetProvinces().Result, "id", "name", assessorViewModel.Address.Province); ViewData["AddressTypeId"] = new SelectList(_lookUpService.GetAddressTypes().Result, "id", "name", assessorViewModel.Address.AddressType); ViewData["SchoolId"] = new SelectList(_lookUpService.GetSchools().Result, "id", "name", assessorViewModel.Learner.School); ViewData["SchoolGradeId"] = new SelectList(_lookUpService.GetSchoolGrades().Result, "id", "name", assessorViewModel.Learner.SchoolGrade); return(View(assessorViewModel)); }
public async Task <IActionResult> Create([Bind("CityId,CityName,CityCode,ProvinceId,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] City city) { if (ModelState.IsValid) { _context.Add(city); await _context.SaveChangesAsync(); _notyf.Success("Created successfully..."); _notyf.Custom("Edited ", 10, "green", "user"); return(RedirectToAction(nameof(Index))); } ViewData["ProvinceId"] = new SelectList(_context.Province, "ProvinceId", "ProvinceName", city.ProvinceId); return(PartialView(city)); }
public async Task <IActionResult> Create([Bind("Id,TypeName,ActiveYn,RoleId,Description,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] DocumentType documentType) { if (ModelState.IsValid) { documentType.CreatedBy = User.Identity.Name; documentType.DateCreated = DateTime.Now; _context.Add(documentType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } // ViewData["RoleId"] = new SelectList(_context.Role, "RoleId", "Name",documentType.RoleId); return(PartialView(documentType)); }
public async Task <IActionResult> Create([Bind("JobTypeId,JobTypeCode,JobTypeDesc,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] JobType jobType) { jobType.CreatedBy = "admin"; jobType.DateCreated = DateTime.Now; jobType.LastUpdatedBy = "admin"; jobType.DateUpdated = DateTime.Now; if (ModelState.IsValid) { _context.Add(jobType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView(jobType)); }
public async Task <IActionResult> Create([Bind("LearnerId,PersonId,SchoolId,SchoolGradeId,MotivationText,YearSchoolCompleted,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Learner learner) { if (ModelState.IsValid) { learner.CreatedBy = "admin"; learner.DateCreated = DateTime.Now; learner.LastUpdatedBy = "admin"; learner.DateUpdated = DateTime.Now; _context.Add(learner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PersonId"] = new SelectList(_context.Person, "PersonId", "PersonId", learner.PersonId); ViewData["SchoolId"] = new SelectList(_context.School, "SchoolId", "SchoolId", learner.SchoolId); ViewData["SchoolGradeId"] = new SelectList(_context.SchoolGrade, "SchoolGradeId", "SchoolGradeId", learner.SchoolGradeId); return(PartialView(learner)); }
public async Task <IActionResult> Create([Bind("AddressId,HouseNo,StreetName,SurburbId,CityId,PostalCode,ProvinceId,CountryId,AddressTypeId,PersonId,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] Address address) { if (ModelState.IsValid) { address.CreatedBy = "admin"; address.DateCreated = DateTime.Now; address.LastUpdatedBy = "admin"; address.DateUpdated = DateTime.Now; _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddressTypeId"] = new SelectList(_context.AddressType, "AddressTypeId", "AddressTypeId", address.AddressTypeId); ViewData["CityId"] = new SelectList(_context.City, "CityId", "CityId", address.CityId); ViewData["SuburbId"] = new SelectList(_context.Suburb, "SuburbId", "SuburbId", address.Suburb); ViewData["CountryId"] = new SelectList(_context.Country, "CountryId", "CountryId", address.CountryId); ViewData["PersonId"] = new SelectList(_context.Person, "PersonId", "PersonId", address.PersonId); ViewData["ProvinceId"] = new SelectList(_context.Province, "ProvinceId", "ProvinceId", address.ProvinceId); return(View(address)); }
public async Task <IActionResult> Create([Bind("AddressTypeId,AddressTypeName,AddressTypeCode,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] AddressType addressType) { try { if (!ModelState.IsValid) { string messages = string.Join("; ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); throw new Exception("Please correct the following errors: " + Environment.NewLine + messages); } _context.Add(addressType); await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }