Exemplo n.º 1
0
 public ActionResult SaveCreate(CreateHoSoUngVienModel model, HttpPostedFileBase AvatarUser, List <string> name_FileHoSoUngVien, List <HttpPostedFileBase> FileHoSoUngVien)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var EntityModel = _mapper.Map <TD_HoSoUngVien>(model);
             _hoSoUngVienService.Create(EntityModel);
             if (FileHoSoUngVien != null && FileHoSoUngVien.Any())
             {
                 var resultfield = _taiLieuDinhKemService.SaveMultiFile(LoaiTaiLieuUploadConstant.HoSoUngVien, EntityModel.Id, FileHoSoUngVien, name_FileHoSoUngVien, null, null, LoaiTaiLieuUploadConstant.HoSoUngVien, HostingEnvironment.MapPath("/Uploads"), CurrentUserId);
                 if (!resultfield.Status)
                 {
                     TempData["MessageError"] = resultfield.Message;
                 }
             }
             TempData["MessageSuccess"] = "Tạo hồ sơ ứng viên thành công";
             return(RedirectToAction("Index"));
         }
         TempData["MessageError"] = "Lỗi dữ liệu";
         return(RedirectToAction("Create"));
     }
     catch (Exception ex)
     {
         _loger.Error("Lỗi khi lưu thông tin ứng viên", ex);
         throw new HttpException("Lỗi khi lưu dữ liệu hồ sơ ứng viên", ex);
     }
 }
Exemplo n.º 2
0
        public ActionResult SaveCreate(CreateDotTuyenDungModel model, List <int> DsYeuCauTuyenDung, List <string> name_FileDotTuyenDung, List <HttpPostedFileBase> FileDotTuyenDung)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var EntityModel = _mapper.Map <TD_DotTuyenDung>(model);
                    EntityModel.TrangThai = DotTuyenDungTrangThaiConst.MoiTao;
                    _DotTuyenDungService.Create(EntityModel);
                    _DotTuyenDungService.SaveYeuCauOfDotTuyenDung(DsYeuCauTuyenDung, EntityModel.Id);

                    if (FileDotTuyenDung != null && FileDotTuyenDung.Any())
                    {
                        var resultfield = _taiLieuDinhKemService.SaveMultiFile(LoaiTaiLieuUploadConstant.DotTuyenDung, EntityModel.Id, FileDotTuyenDung, name_FileDotTuyenDung, null, null, LoaiTaiLieuUploadConstant.DotTuyenDung, HostingEnvironment.MapPath("/Uploads"), CurrentUserId);
                        if (!resultfield.Status)
                        {
                            TempData["MessageError"] = resultfield.Message;
                        }
                    }
                    TempData["MessageSuccess"] = "Tạo đợt tuyển dụng thành công";
                    return(RedirectToAction("Index"));
                }
                TempData["MessageError"] = "Lỗi dữ liệu";

                return(RedirectToAction("Create"));
            }
            catch (Exception ex)
            {
                _logger.Error("Lỗi khi lưu thông tin đợt tuyển dụng", ex);
                throw new HttpException("Lỗi khi lưu dữ liệu đợt tuyển dụng", ex);
            }
        }