예제 #1
0
        public async Task <ActionResult <ResponseModel> > Create(ResumeCreateViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            if (model.RealName.Trim().Length <= 0)
            {
                response.SetFailed("请输入简历名称");
                return(Ok(response));
            }

            await using (_dbContext)
            {
                if (await _dbContext.ResumeInfo.
                    CountAsync(x => x.RealName == model.RealName) > 0)
                {
                    response.SetFailed("简历已存在");
                    return(Ok(response));
                }
                var entity = _mapper.Map <ResumeCreateViewModel, ResumeInfo>(model);
                entity.CreatedOn         = DateTime.Now;
                entity.Code              = RandomHelper.GetRandomizer(8, true, false, true, true);
                entity.CreatedByUserGuid = AuthContextService.CurrentUser.Guid;
                entity.CreatedByUserName = AuthContextService.CurrentUser.DisplayName;

                await _dbContext.ResumeInfo.AddAsync(entity);

                await _dbContext.SaveChangesAsync();

                response.SetSuccess();
                return(Ok(response));
            }
        }
예제 #2
0
        public async Task <ActionResult <ResponseModel> > Edit(ResumeCreateViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            if (ConfigurationManager.AppSettings.IsTrialVersion)
            {
                response.SetIsTrial();
                return(Ok(response));
            }

            await using (_dbContext)
            {
                if (await _dbContext.ResumeInfo.CountAsync(x => x.RealName == model.RealName &&
                                                           x.Code != model.Code) > 0)
                {
                    response.SetFailed("简历已存在");
                    return(Ok(response));
                }

                var entity = _mapper.Map <ResumeCreateViewModel, ResumeInfo>(model);



                entity.ModifiedOn         = DateTime.Now;
                entity.ModifiedByUserGuid = AuthContextService.CurrentUser.Guid;
                entity.ModifiedByUserName = AuthContextService.CurrentUser.DisplayName;

                _dbContext.Entry(entity).State = EntityState.Modified;
                await _dbContext.SaveChangesAsync();

                return(Ok(response));
            }
        }
예제 #3
0
        public IActionResult Index()
        {
            var information  = _context.Informations.SingleOrDefault();
            var experiences  = _context.Experiences.ToList();
            var educations   = _context.Educations.ToList();
            var certificates = _context.Certificates.ToList();
            var skills       = _context.Skills.ToList();

            ResumeCreateViewModel resumeCreateViewModel = new ResumeCreateViewModel
            {
                Skills       = skills,
                Information  = information,
                Experiences  = experiences,
                Educations   = educations,
                Certificates = certificates
            };

            return(View(resumeCreateViewModel));
        }