Exemplo n.º 1
0
        public ActionResult CreateJobApplication(ApplicationEditViewModel jevm)
        {
            JobApplication jobApplication = jevm.Item;

            if (ModelState.IsValid)
            {
                if (jevm.ResumeFile != null && jevm.ResumeFile.ContentLength > 0)
                {
                    var applicationFolder = "/Content/JobApplications/";
                    var filename          = DateTime.Now.ToBinary().ToString("x") +
                                            Path.GetFileName(jevm.ResumeFile.FileName);
                    var path = Path.Combine(Server.MapPath("~" + applicationFolder), filename);
                    jevm.ResumeFile.SaveAs(path);
                    jevm.Item.ResumeFileName = applicationFolder + filename;
                }

                if (jevm.CoverLetterFile != null && jevm.CoverLetterFile.ContentLength > 0)
                {
                    var applicationFolder = "/Content/JobApplications/";
                    var filename          = DateTime.Now.ToBinary().ToString("x") +
                                            Path.GetFileName(jevm.CoverLetterFile.FileName);
                    var path = Path.Combine(Server.MapPath("~" + applicationFolder), filename);
                    jevm.CoverLetterFile.SaveAs(path);
                    jevm.Item.CoverLetterFileName = applicationFolder + filename;
                }
                db.JobApplications.Add(jobApplication);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(ApplicationEditViewModel app)
        {
            if (ModelState.IsValid)
            {
                _appManager.Update(app);
            }

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Edit(ApplicationEditViewModel viewModel)
        {
            var application = new Application {
                Code = viewModel.Code, Name = viewModel.Name, RecordDate = DateTime.Now
            };

            await _marketingProvider.Applications.UpsertAsync(application);

            return(Redirect("/Applications/GetAll"));
        }
        public async Task <IActionResult> Edit(string code)
        {
            var application = await _marketingProvider.Applications.GetByCodeAsync(code);

            var applicationEditViewModel = new ApplicationEditViewModel {
                Code = application.Code, Name = application.Name
            };

            return(View(applicationEditViewModel));
        }
Exemplo n.º 5
0
        public void Update(ApplicationEditViewModel updatedObject)
        {
            if (updatedObject.SelectedTags != null && updatedObject.SelectedTags.Count() != 0)
            {
                var res = _tagRepository.Find(p => updatedObject.SelectedTags.Cast <int>().Contains(p.PK_ID));
                if (res.Any())
                {
                    foreach (var tag in res)
                    {
                        updatedObject.Application.Tags.Add(tag);
                    }
                }
            }

            _appRepository.Update(updatedObject.Application);
            _appRepository.Save();
        }
Exemplo n.º 6
0
        public ApplicationEditViewModel Update(int updatedObjectPrimaryKey)
        {
            ApplicationEditViewModel vm = new ApplicationEditViewModel();

            vm.Application = _appRepository.GetById(updatedObjectPrimaryKey);
            vm.Users       = _userRepository
                             .All()
                             .ToList()
                             .Select(e => new SelectListItem {
                Text = e.Name, Value = e.PK_ID.ToString()
            })
                             .WithEmptyItem("Select developer")
                             .WithSelection(vm.Application.FK_Developer.ToString())
                             .ToList();

            // getting tags
            IEnumerable <SRREntityTagKeywords> tags = _tagRepository.All().ToList();

            vm.Tags = new MultiSelectList(tags, "PK_ID", "Name", vm.Application.Tags.Select(p => p.PK_ID).ToArray());

            return(vm);
        }
Exemplo n.º 7
0
        public ActionResult Edit(int id, ApplicationEditViewModel applicationEditViewModel)
        {
            if (ModelState.IsValid)
            {
                var application = context.Applications.SingleOrDefault(a => a.Id == id);
                var user        = userManager.FindById(User.Identity.GetUserId());

                if (user == null ||
                    application == null ||
                    (application.UserId != user.Id && !user.IsEmployee))
                {
                    //Unable to find user or application, or unauthorized: return to start
                    return(RedirectToAction("Index", "Position", new { }));
                }

                application.Status = applicationEditViewModel.ApplicationStatus;
                context.SaveChanges();

                return(RedirectToAction("Details", new { id = id }));
            }

            return(View(applicationEditViewModel));
        }
        public async Task <IActionResult> Delete(ApplicationEditViewModel viewModel)
        {
            await _marketingProvider.Applications.DeleteAsync(viewModel.Code);

            return(Redirect("/Applications/GetAll"));
        }