Ejemplo n.º 1
0
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("List"));
            }

            var applyJob = applyJobService.GetById(id.Value);

            if (applyJob == null)
            {
                this.NotifyError("Item not found.");
                return(RedirectToAction("List"));
            }

            if (applyJob.IsRead == false)
            {
                applyJob.IsRead = true;
                applyJobService.Save(applyJob);
            }

            var model = new ApplyJobModel
            {
                Id        = applyJob.Id,
                FullName  = applyJob.FullName,
                Email     = applyJob.Email,
                Phone     = applyJob.Phone,
                ApplyDate = applyJob.ApplyDateUtc,
                Message   = applyJob.Message,
                IsActive  = applyJob.IsActive,
                JobName   = applyJob.Job.Title
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ApplyJob(JobDetailModel model)
        {
            var alert = HtmlHelper.Vertex().Alert();

            if (string.IsNullOrEmpty(model.ApplyJob.Email))
            {
                return(Json(alert.Text("Email can not be emty.").Color(BootstrapColor.Warning).ToHtmlString(), JsonRequestBehavior.AllowGet));
            }

            if (ModelState.IsValid)
            {
                ApplyJob applyJob = new ApplyJob();
                applyJob.FullName     = model.ApplyJob.FullName;
                applyJob.Email        = model.ApplyJob.Email;
                applyJob.Phone        = model.ApplyJob.Phone;
                applyJob.Message      = model.ApplyJob.Message;
                applyJob.JobId        = model.ApplyJob.JobId;
                applyJob.ApplyDateUtc = DateTime.UtcNow;
                applyJob.IsActive     = true;

                var result = applyJobService.Save(applyJob);
                if (result)
                {
                    return(Json(alert.Text("Thank you, your email successfully added.").Color(BootstrapColor.Success).ToHtmlString(), JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(alert.Text("Something is wrong, please try again.").Color(BootstrapColor.Danger).ToHtmlString(), JsonRequestBehavior.AllowGet));
        }