public void EditReferral(ENJobExchange.Areas.PartnerPortal.ViewModels.JobPostingViewModel model)
        {
            ENJobExchange.DAL.JobPosting dataJobPosting = db.JobPostings.Where(x => x.JobPostingID == JobPostingID).Single();

            dataJobPosting.Active_YN = this.jobPosting.Active_YN;
            //dataJobPosting.BusinessCategory = model.jobPosting.BusinessCategory;
            dataJobPosting.ContactID = model.jobPosting.ContactID;
            dataJobPosting.CreatedDT = model.jobPosting.CreatedDT;
            dataJobPosting.Description_External = model.jobPosting.Description_External;
            dataJobPosting.Description_JobPosting = model.jobPosting.Description_JobPosting;
            dataJobPosting.EstHoursPerWeek = model.jobPosting.EstHoursPerWeek;
            //dataJobPosting.JobPostingID = model.jobPosting.JobPostingID;
            dataJobPosting.JobTitle = model.jobPosting.JobTitle;
            dataJobPosting.LocationID = model.jobPosting.LocationID;
            //dataJobPosting.PartnerID = model.jobPosting.PartnerID;
            dataJobPosting.PartnerJobLevel = model.jobPosting.PartnerJobLevel;
            dataJobPosting.PartnerRequisitionNumber = model.jobPosting.PartnerRequisitionNumber;
            //dataJobPosting.PositionID = model.jobPosting.PositionID;
            dataJobPosting.PostingStartDate = model.jobPosting.PostingStartDate;
            dataJobPosting.PostingEndDate = model.jobPosting.PostingEndDate;
            //dataJobPosting.Requirements = model.jobPosting.Requirements;
            //dataJobPosting.WorkSchedule = model.jobPosting.WorkSchedule;

            db.Entry(dataJobPosting).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
        public ActionResult Create(ENJobExchange.Areas.ENPortal.ViewModels.Referral rfl)
        {
            try
            {
                if (ModelState.IsValid)
                {

                    rfl.SaveToDB();

                    return RedirectToAction("Index", "Jobs", new { id = 0 });
                }
            }
            catch (Exception er1)
            {

                ModelState.AddModelError("", er1.Message);

                //Log the error (uncomment dex variable name and add a line here to write a log.)
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, contact your system administrator.");
            }
            return View();
               // return View(rfl);
        }
 public ActionResult Edit(ENJobExchange.Areas.PartnerPortal.ViewModels.JobPostingViewModel jpvm)
 {
     try
     {
         if (ModelState.IsValid)
         {
             jpvm.EditReferral(jpvm);
         }
         return RedirectToAction("Index", new { PartnerID = jpvm.jobPosting.PartnerID });
     }
     catch
     {
         return View();
     }
 }
        public ActionResult Details(ENJobExchange.DAL.ReferralNote refNote, int ReferralStatus = 0)
        {
            if (!(ReferralStatus == 0))
            {
                var ReferralRecordToUpdate =
                    (from r in db.Referrals
                     where r.ReferralID == refNote.ReferralID
                     select r).Single();
                ReferralRecordToUpdate.ReferralStatusID = ReferralStatus;
                UpdateModel(ReferralRecordToUpdate);
                db.SaveChanges();
            }

            if (ModelState.IsValid)
            {
                if (!(refNote.Note == "" || refNote.Note == null)) //Doesn't update is Note is empty  THIS PROBABLY NEEDS TO BE CHANGED FOR STATUS
                {
                    db.Entry(refNote).State = System.Data.Entity.EntityState.Added;
                    UpdateModel(refNote);
                    db.SaveChanges();
                    return RedirectToAction("Details", "Referral", new { referralID = refNote.ReferralID });
                }
                return RedirectToAction("Details", "Referral", new { referralID = refNote.ReferralID });
            }
            return RedirectToAction("Details", "Referral", new { referralID = refNote.ReferralID });
        }