ویومدل ویرایش مصاحبه
Inheritance: Decision.ViewModel.Common.BaseRowVersion
Ejemplo n.º 1
0
        public async Task EditAsync(EditInterviewViewModel viewModel)
        {
            var interview = await _interviews.FirstAsync(a => a.Id == viewModel.Id);
            _mappingEngine.Map(viewModel, interview);
            interview.LasModifierId = _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);
            }
        }
Ejemplo n.º 2
0
 public async Task FillEditViewModel(EditInterviewViewModel viewModel)
 {
     viewModel.Interviewers = await _appraiserService.GetAsSelectedListItem(viewModel.InterviewerId);
 }
Ejemplo n.º 3
0
 public async Task EditAsync(EditInterviewViewModel viewModel)
 {
     var interview = await _interviews.FirstAsync(a => a.Id == viewModel.Id);
     _mappingEngine.Map(viewModel, interview);
 }
Ejemplo n.º 4
0
        public virtual async Task<ActionResult> Edit(EditInterviewViewModel viewModel)
        {
            if (!_referentialTeacherService.CanManageTeacher(viewModel.TeacherId)) return HttpNotFound();

            if (!await _interviewService.IsInDb(viewModel.Id))
                this.AddErrors("Body", "مصاحبه مورد نظر توسط یکی از کاربران در شبکه،حذف شده است");

            if (!ModelState.IsValid)
            {
                await _interviewService.FillEditViewModel(viewModel);
                return View(viewModel);
            }

            viewModel.Brief = viewModel.Brief.ToSafeHtml();
            viewModel.Body = viewModel.Body.ToSafeHtml();
            await _interviewService.EditAsync(viewModel);
            var message = await _unitOfWork.ConcurrencySaveChangesAsync();
            if (message.HasValue())
                this.AddErrors("Body", string.Format(message, "مصاحبه"));

            if (ModelState.IsValid) return RedirectToAction(MVC.Interview.List(viewModel.TeacherId));
            await _interviewService.FillEditViewModel(viewModel);
            return View(viewModel);
        }
Ejemplo n.º 5
0
 public virtual async Task<ActionResult> Edit(EditInterviewViewModel viewModel)
 {
     if (!ModelState.IsValid)
         return View(viewModel);
     viewModel.Brief = viewModel.Brief.ToSafeHtml();
     viewModel.Body = viewModel.Body.ToSafeHtml();
     await _interviewService.EditAsync(viewModel);
     await _unitOfWork.SaveAllChangesAsync(); return RedirectToAction(MVC.Interview.List(viewModel.ApplicantId));
   
 }