/// NAME: Hassan Karar
        /// DATE: 2020/3/10
        /// CHECKED BY:
        /// <summary>
        /// This method is saving the edited job Listing.
        /// </summary>
        /// <remarks>
        /// UPDATED BY:
        /// UPDATE DATE:
        /// WHAT WAS CHANGED:
        /// <param name="sender"></param>
        ///  <param name="e"></param>
        /// </remarks>
        ///
        private void btnEditSave_Click_1(object sender, RoutedEventArgs e)
        {
            bool result = false;

            DataTransferObjects.JobListing newJobListing = new DataTransferObjects.JobListing();

            newJobListing.Responsibilities = txtEditDescription.Text;
            newJobListing.Benefits         = txtEditBenefits.Text;
            newJobListing.Requirements     = txtEditRequirements.Text;
            try
            {
                newJobListing.StartingWage = Convert.ToDecimal(txtEditStartingWage.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Starting Wage should be a number");
                return;
            }

            if (EditAdmin.IsSelected)
            {
                newJobListing.RoleID = EditAdmin.Content.ToString();
            }
            else if (EditCustomer.IsSelected)
            {
                newJobListing.RoleID = EditCustomer.Content.ToString();
            }
            else if (EditEmployee.IsSelected)
            {
                newJobListing.RoleID = EditEmployee.Content.ToString();
            }
            else if (EditVolunteer.IsSelected)
            {
                newJobListing.RoleID = EditVolunteer.Content.ToString();
            }

            result = _jobListingManager.EditJobListing(newJobListing, oldJobListing);



            if (result == true)
            {
                MessageBox.Show("done");
            }
            else
            {
                MessageBox.Show("Not done");
            }

            canEditJobListing.Visibility = Visibility.Hidden;
            canViewJobListing.Visibility = Visibility.Visible;
            populatedgAdoptionApplicationsList();
        }
        public HttpResponseMessage UpdateJobListing([FromBody] JobListingEntity joblisting)
        {
            var result = new Result();

            object objemployer = null;

            Request.Properties.TryGetValue("employer", out objemployer);
            if (objemployer == null)
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, new Result(false)));
            }
            var employer = objemployer as EmployerEntity;

            //get full entity
            result = _employersManager.GetEmployerById(joblisting.EmployerId);
            var employer_entity = (EmployerEntity)result.Entity;


            if (employer.EmployerId != employer_entity.EmployerId)
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, new Result(false)));
            }

            if (employer_entity.MembershipEndDate < (DateTime?)DateTime.Now)
            {
                joblisting.PublishStatus = false;
            }

            result = new Result();

            result = _jobListingManager.EditJobListing(joblisting);
            if (!result.Success)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, result));
            }
            result.Entity = _jobListingManager.GetListingById(joblisting.JobListingId).Entity;
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }