ویومدل درج مصاحبه
예제 #1
0
 public virtual async Task<ActionResult> Create(AddInterviewViewModel viewModel)
 {
     
     if (!ModelState.IsValid)
     {
         
         return new JsonNetResult
         {
             Data = new
             {
                 success = false,
                 View = this.RenderPartialViewToString(MVC.Interview.Views._Create, viewModel)
             }
         };
     }
     viewModel.Brief = viewModel.Brief.ToSafeHtml();
     viewModel.Body = viewModel.Body.ToSafeHtml();
     var newInterview = await _interviewService.Create(viewModel);
     return new JsonNetResult
     {
         Data = new
         {
             success = true,
             View = this.RenderPartialViewToString(MVC.Interview.Views._InterviewItem, newInterview)
         }
     };
 }
예제 #2
0
 public async Task<InterviewViewModel> Create(AddInterviewViewModel viewModel)
 {
     var interview = _mappingEngine.Map<Interview>(viewModel);
    
     _interviews.Add(interview);
     await _unitOfWork.SaveChangesAsync();
     return await _interviews
         .Include(a => a.CreatedBy).Include(a => a.ModifiedBy).AsNoTracking()
         .ProjectTo<InterviewViewModel>(_mappingEngine)
         .FirstOrDefaultAsync(a => a.Id == interview.Id);
 }
예제 #3
0
 public async Task<InterviewViewModel> Create(AddInterviewViewModel viewModel)
 {
     var interview = _mappingEngine.Map<Interview>(viewModel);
     interview.CreatorId = _userManager.GetCurrentUserId();
     if (viewModel.AttachmentScan.HasValue())
         interview.Attachment = Convert.FromBase64String(viewModel.AttachmentScan);
     else if (viewModel.AttachmentFile.HasFile())
     {
         interview.Attachment =
             viewModel.AttachmentFile.InputStream.ConvertToByteArrary(viewModel.AttachmentFile.ContentLength);
     }
     _interviews.Add(interview);
     await _unitOfWork.SaveChangesAsync();
     return await _interviews.Include(a => a.Interviewer)
         .Include(a => a.Creator).Include(a => a.LasModifier).AsNoTracking()
         .ProjectTo<InterviewViewModel>(_mappingEngine)
         .FirstOrDefaultAsync(a => a.Id == interview.Id);
 }
예제 #4
0
 public async Task FillAddViewModel(AddInterviewViewModel viewModel)
 {
     viewModel.Interviewers = await _appraiserService.GetAsSelectedListItem(null);
 }
예제 #5
0
        public virtual async Task<ActionResult> Create(AddInterviewViewModel viewModel)
        {
            if (!_referentialTeacherService.CanManageTeacher(viewModel.TeacherId)) return HttpNotFound();

            if (!ModelState.IsValid)
            {
                await _interviewService.FillAddViewModel(viewModel);
                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View = this.RenderPartialViewToString(MVC.Interview.Views._Create, viewModel)
                    }
                };
            }
            viewModel.Brief = viewModel.Brief.ToSafeHtml();
            viewModel.Body = viewModel.Body.ToSafeHtml();
            var newInterview = await _interviewService.Create(viewModel);
            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View = this.RenderPartialViewToString(MVC.Interview.Views._InterviewItem, newInterview)
                }
            };
        }
예제 #6
0
 public virtual ActionResult Create(Guid applicantId)
 {
     var viewModel = new AddInterviewViewModel {ApplicantId = applicantId};
     return PartialView(MVC.Interview.Views._Create, viewModel);
 }