예제 #1
0
        public ActionResult Create(InterviewRoundDocumentViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newDocument = new InterviewRoundDocument()
                {
                    InterviewRoundId = vm.InterviewRoundId,
                    DocumentType     = vm.DocumentType,
                    FileSize         = 0.0
                };

                if (vm.Document != null)
                {
                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadInterviewRoundDocument(vm.Document);
                    newDocument.DocumentPath = blobPath;
                    newDocument.FileName     = vm.Document.FileName;
                }

                _interviewRoundDocumentRepository.Create(newDocument);
                _unitOfWork.Commit();

                return(RedirectToAction("Details", "InterviewRounds", new { id = vm.InterviewRoundId }));
            }

            return(View(vm));
        }
예제 #2
0
        public ActionResult Create(ProjectDocumentViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newDocument = new ProjectDocument
                {
                    ProjectId    = vm.ProjectId,
                    DocumentType = vm.DocumentType,
                    FileSize     = 0.0
                };

                if (vm.Document != null)
                {
                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadProjectDocument(vm.Document);
                    newDocument.DocumentPath = blobPath;
                    newDocument.FileName     = vm.Document.FileName;
                }

                _projectDocumentRepository.Create(newDocument);
                _unitOfWork.Commit();

                return(RedirectToAction("Details", "Projects", new { Id = vm.ProjectId }));
            }

            ViewBag.ProjectId = new SelectList(_projectRepository.GetAll(), "Id", "Title", vm.ProjectId);
            return(View(vm));
        }
        public ActionResult Create(ArticleAttachmentViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newAttachment = new ArticleAttachment
                {
                    ArticleId      = vm.ArticleId,
                    AttachmentType = vm.AttachmentType,
                    FileSize       = 0.0
                };

                if (vm.Document != null)
                {
                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadArticleAttachment(vm.Document);
                    newAttachment.DocumentPath = blobPath;
                    newAttachment.FileName     = vm.Document.FileName;
                }

                _articleAttachmentRepository.Create(newAttachment);
                _unitOfWork.Commit();

                return(RedirectToAction("Edit", "Articles", new { id = vm.ArticleId }));
            }

            ViewBag.ArticleId = new SelectList(_articleRepository.GetAll(), "Id", "Title", vm.ArticleId);

            return(View(vm));
        }
예제 #4
0
        public JsonResult UploadProfileImage(EditImageViewModel vm)
        {
            var apiResult = TryExecute(() =>
            {
                var imageViewModel = new ImageViewModel();
                if (vm.Photo != null)
                {
                    var siteSettings            = _settingsService.GetSiteSettings();
                    var blobUploadService       = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath                = blobUploadService.UploadProfileImage(vm.Photo);
                    imageViewModel.SavedName    = blobPath;
                    imageViewModel.OriginalName = vm.FileName;
                }
                return(imageViewModel);
            }, "Image  uploaded sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult EditImage(EditImageViewModel vm)
        {
            if (vm.Photo != null)
            {
                var selectedUser = _userRepository.GetBy(u => u.Id == WebUser.Id, "Person");
                if (selectedUser != null)
                {
                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadProfileImage(vm.Photo);
                    selectedUser.Person.PhotoPath = blobPath;

                    _userRepository.Update(selectedUser);
                    _unitOfWork.Commit();
                }
            }

            return(RedirectToAction("Index"));
        }
예제 #6
0
        public ActionResult Create(NewCandidateViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newCandidate = new Candidate
                {
                    Source          = vm.Source,
                    Qualification   = vm.Qualification,
                    TotalExperience = vm.TotalExperience,
                    ResumePath      = vm.ResumePath,
                    PhotoPath       = vm.PhotoPath,
                    Status          = vm.Status,
                    Comments        = vm.Comments,
                    CurrentCTC      = vm.CurrentCTC,
                    ExpectedCTC     = vm.ExpectedCTC,
                    Person          = vm.Person,
                    DesignationId   = vm.CandidateDesignationId
                };


                // Clean up white spaces for Email and Phone Numbers
                if (!string.IsNullOrEmpty(newCandidate.Person.Email))
                {
                    newCandidate.Person.Email = newCandidate.Person.Email.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.SecondaryEmail))
                {
                    newCandidate.Person.SecondaryEmail = newCandidate.Person.SecondaryEmail.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.PhoneNo))
                {
                    newCandidate.Person.PhoneNo = newCandidate.Person.PhoneNo.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.OfficePhone))
                {
                    newCandidate.Person.OfficePhone = newCandidate.Person.OfficePhone.Trim();
                }

                newCandidate.RecievedOn = vm.RecievedOn;

                newCandidate.CreatedByUserId = WebUser.Id;

                _candidateRepository.Create(newCandidate);
                _unitOfWork.Commit();

                // Update the Candidate Code.
                var selectedCandidate = _candidateRepository.Get(newCandidate.Id);
                if (selectedCandidate != null)
                {
                    selectedCandidate.Code = $"LA{selectedCandidate.Id.ToString("D" + 6)}";
                    _candidateRepository.Update(selectedCandidate);
                    _unitOfWork.Commit();
                }

                // Map the Technologies
                if (vm.TechnologyIds != null)
                {
                    foreach (var technologyId in vm.TechnologyIds)
                    {
                        var newMap = new CandidateTechnologyMap
                        {
                            CandidateId  = newCandidate.Id,
                            TechnologyId = technologyId
                        };

                        _candidateTechnologyMapRepository.Create(newMap);
                    }

                    _unitOfWork.Commit();
                }

                // Add the resume and map it to docs.
                if (vm.Resume != null)
                {
                    var newDocument = new CandidateDocument
                    {
                        CandidateId  = newCandidate.Id,
                        DocumentType = CandidateDocumentType.Resume
                    };

                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadRecruitDocument(vm.Resume);
                    newDocument.DocumentPath = blobPath;
                    newDocument.FileName     = vm.Resume.FileName;

                    _candidateDocumentRepository.Create(newDocument);
                    _unitOfWork.Commit();
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.CandidateDesignationId = new SelectList(_candidateDesignationRepository.GetAll(), "Id", "Title");
            return(View(vm));
        }