public async Task <PartialViewResult> CreateOrEditQualificationModal(int?id, int employeeId) { var output = new EducationDto(); if (id != null) { output = _employeeService.GetEducation(new GetEducationInput { EducationId = id.Value }); } var viewModel = new CreateOrEditQualificationModel(output, id == null || id == 0); ViewBag.EmployeeId = employeeId; var yearList = new List <int>(); for (var y = Clock.Now.Year; y >= 1900; y--) { yearList.Add(y); } ViewBag.Years = new SelectList(yearList, output.Year); ViewBag.EducationalLevels = new SelectList(_qualificationService.GetEducationLevels().Items, "Id", "Name", output.LevelId); return(PartialView("EmployeeDetail/Qualification/_CreateOrEditQualificationModal", viewModel)); }
public async Task <List <EducationDto> > GetEducationInfo(long userId) { if ((AbpSession.UserId.Value != userId) && !await UserManager.IsGrantedAsync(AbpSession.UserId.Value, PermissionNames.Pages_View_CVEmployee)) { throw new UserFriendlyException(ErrorCodes.Forbidden.AccessOtherProfile); } var lstEdu = new List <EducationDto>(); foreach (var edu in WorkScope.GetAll <Educations>().Where(e => e.CvemployeeId.Value == userId && e.IsDeleted == false).OrderBy(e => e.Order)) { var temp = new EducationDto { Id = edu.Id, SchoolOrCenterName = edu.SchoolOrCenterName, CvemployeeId = userId, DegreeType = edu.DegreeType, StartYear = edu.StartYear, EndYear = edu.EndYear, Description = edu.Description, Major = edu.Major, Order = edu.Order, }; lstEdu.Add(temp); } return(lstEdu); }
public static EducationSetDetailViewModel ToDetailViewModel(this EducationDto source) { return(new EducationSetDetailViewModel { Id = source.Id, Description = source.Description, }); }
public async Task <IActionResult> AddEducation(EducationDto educationDto) { var education = _mapper.Map <Education>(educationDto); education.UserId = UserId; _context.Educations.Add(education); await _context.SaveChangesAsync(); return(NoContent()); }
public IActionResult OnGet(int educationId) { Education = repository.GetEducationById(educationId); if (Education == null) { RedirectToPage("./NotFound"); } return(Page()); }
public async Task <EducationDto> SaveEducation(EducationDto input) { if ((!WorkScope.GetAll <User, long>().Any(u => u.Id == input.CvemployeeId) || (!input.CvemployeeId.HasValue))) { throw new UserFriendlyException(ErrorCodes.NotFound.UserNotExist); } if (AbpSession.UserId.Value != input.CvemployeeId) { throw new UserFriendlyException(ErrorCodes.Forbidden.AccessOtherProfile); } int startYear, endYear; if (!(int.TryParse(input.StartYear, out startYear) && int.TryParse(input.EndYear, out endYear))) { throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearIsNotValid); } if (startYear > endYear) { throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearOutOfRange); } if (input.Id <= 0) { var education = new Educations { CvemployeeId = input.CvemployeeId, SchoolOrCenterName = input.SchoolOrCenterName, DegreeType = input.DegreeType, Major = input.Major, StartYear = input.StartYear, EndYear = input.EndYear, Description = input.Description, Order = input.Order }; await WorkScope.GetRepo <Educations, long>().InsertAsync(education); return(input); } else { var education = await WorkScope.GetAsync <Educations>(input.Id); education.CvemployeeId = input.CvemployeeId; education.SchoolOrCenterName = input.SchoolOrCenterName; education.DegreeType = input.DegreeType; education.Major = input.Major; education.StartYear = input.StartYear; education.EndYear = input.EndYear; education.Description = input.Description; education.Order = input.Order; await WorkScope.GetRepo <Educations, long>().UpdateAsync(education); return(input); } }
public static EducationViewModel ToViewModel(this EducationDto source) { return(new EducationViewModel { Id = source.Id, Image = source.Image, Title = source.Title, Description = source.Description, Files = source.Files?.ToViewModel() }); }
public Boolean deleteEducation(EducationDto obj) { try { IEducationSvc svc = (IEducationSvc)this.getService(typeof(IEducationSvc).Name); return svc.deleteEducation(obj); } catch (ServiceLoadException ex) { return false; } }
public EducationDto selectEducationById(EducationDto obj) { try { IEducationSvc svc = (IEducationSvc)this.getService(typeof(IEducationSvc).Name); return svc.selectEducationById(obj); } catch (ServiceLoadException ex) { return null; } }
public EducationDto selectEducationById(EducationDto obj) { NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient(); try { return svc.selectEducationById(obj); } catch (Exception ex) { return null; } }
public Boolean insertEducation(EducationDto obj) { using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient()) { try { return svc.insertEducation(obj); } catch (Exception ex) { return false; } } }
public EducationDto UpdateEducation(EducationDto educationDto) { if (educationDto.Id <= 0) { return(null); } var education = educationDto.ToEntity(); var updated = _educationDao.Update(education); _educationDao.Commit(); return(updated.ToDto()); }
public IHttpActionResult CreateEducation(EducationDto educationDto) { if (!ModelState.IsValid) { return(BadRequest()); } var education = Mapper.Map <EducationDto, Education>(educationDto); _context.Educations.Add(education); _context.SaveChanges(); educationDto.Id = education.Id; return(Created(new Uri(Request.RequestUri + "/" + education.Id), educationDto)); }
public IActionResult OnGet(int?educationId) { if (educationId.HasValue) { Education = repository.GetEducationById(educationId.Value); } else { Education = new EducationDto(); } if (Education == null) { return(RedirectToPage("/index")); } return(Page()); }
/// <summary> /// Update a Education content. /// </summary> /// <param name="body">The data of the content to be created or updated. /// <param name="id">The id of the Education content.</param> /// <returns>EducationContentDto</returns> public EducationContentDto UpdateEducationContent(EducationDto body, string id) { // verify the required parameter 'body' is set if (body == null) { throw new ApiException(400, "Missing required parameter 'body' when calling UpdateEducationContent"); } // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling UpdateEducationContent"); } var path = "/content/mycv/education/{id}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "id" + "}", ApiClient.ParameterToString(id)); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "squidex-oauth-auth" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling UpdateEducationContent: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling UpdateEducationContent: " + response.ErrorMessage, response.ErrorMessage); } return((EducationContentDto)ApiClient.Deserialize(response.Content, typeof(EducationContentDto), response.Headers)); }
public IHttpActionResult UpdateEducation(int id, EducationDto educationDto) { if (!ModelState.IsValid) { return(BadRequest()); } var educationInDb = _context.Educations.SingleOrDefault(e => e.Id == id); if (educationInDb == null) { return(NotFound()); } Mapper.Map(educationDto, educationInDb); _context.SaveChanges(); return(Ok()); }
public string CreateEducation(EducationDto educationDto) { string returnMessage; var education = educationDto.ToEntity(); if (education.Id > 0) { _educationDao.Update(education); returnMessage = "Education updated"; } else { _educationDao.Create(education); returnMessage = "Education created"; } _educationDao.Commit(); return(returnMessage); }
public Boolean deleteEducation(EducationDto obj) { using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient()) { try { EducationDto rec = svc.selectEducationById(obj); if (rec != null) { return svc.deleteEducation(obj); } else { return false; } } catch (Exception ex) { return false; } } }
public void OnGet(int educationId) { Education = repository.GetEducationById(educationId); }
public IHttpActionResult NewEducation(EducationDto educationDto) { return(Ok()); }
public Task <EducationDto> Post(EducationDto education) { throw new NotImplementedException(); }
public ActionResult <EducationDto> Post(EducationDto education) { repository.CreateEducation(education); return(CreatedAtAction("GetEducation", education)); }
public IActionResult Patch(EducationDto education) { repository.UpdateEducation(education); return(Ok("Education updated")); }
public CreateOrEditQualificationModel(EducationDto input, bool isNew) { IsEditMode = !isNew; Education = input; }