public ActionResult RejectRequest(int jobRequestId) { if (Session["UserId"] == null) { return(RedirectToAction("LogOn", "Account")); } JobRequest jobRequest = _RequestService.GetRequest(jobRequestId); if (jobRequest != null) { jobRequest.RequestStatus = EnumValue.GetEnumDescription(EnumValue.RequestStatus.Declined); _RequestService.UpdateRequest(jobRequest); AgencyJob agencyjob = _AgencyJobService.GetAgencyJobByJobRequest(jobRequestId); if (agencyjob != null) { _AgencyJobService.DeleteAgencyJob(agencyjob); } return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Details(int?key, int JobRequestId) { //UserPermissionAction("Category", RoleAction.view.ToString(), operation, ShowMessage, MessageBody); //CheckPermission(); if (Session["UserId"] == null) { return(RedirectToAction("LogOn", "Account")); } if (key == 1) { Session["CurrentPageNumber"] = null; } if (Session["CurrentPageNumber"] == null) { ViewBag.currentPageNumber = 0; } else { ViewBag.currentPageNumber = Convert.ToInt32(Session["CurrentPageNumber"]); } int id = Convert.ToInt32(Session["UserId"].ToString()); if (id > 0) { var details = new JobDetails(); var job = _RequestService.GetRequest(JobRequestId); if (job != null) { Mapper.CreateMap <JobRequest, RequestModel>(); var model = Mapper.Map <JobRequest, RequestModel>(job); var category = _CategoryService.GetCategory(model.CategoryId); if (category != null) { details.CategoryName = category.Name; } if (job.IsPaid == true) { var customerpaymentdata = _CustomerPaymentService.GetCustomerPaymentByJobRequestId(JobRequestId); Mapper.CreateMap <CustomerPayment, CustomerPaymentModel>(); CustomerPaymentModel customerPaymentModel = Mapper.Map <CustomerPayment, CustomerPaymentModel>(customerpaymentdata); details.customerPaymentModel = customerPaymentModel; } List <Reviews> objReview = new List <Reviews>(); var reviews = _ReviewAndRatingService.GetReviewAndRatings().Where(r => r.JobRequestId == JobRequestId).ToList(); float rating = 0; foreach (var review in reviews) { Mapper.CreateMap <ReviewAndRating, Reviews>(); Reviews reviewModel = Mapper.Map <ReviewAndRating, Reviews>(review); rating += Convert.ToSingle(reviewModel.Rating); var customer = _CustomerService.GetCustomer(reviewModel.CustomerId); reviewModel.CustomerName = customer.FirstName + " " + customer.LastName; reviewModel.PhotoPath = customer.PhotoPath; reviewModel.ReviewAndRatingId = review.ReviewAndRatingId; objReview.Add(reviewModel); } // DealResponseModel.AverageRating = float.IsNaN(rating / reviews.Count()) ? 0 : (rating / reviews.Count()); details.Reviews = objReview; details.TotalReviews = reviews.Count(); //START:Get detail of job assign individual AgencyJob agencyJobData = _AgencyJobService.GetAgencyJobByJobRequest(JobRequestId); if (agencyJobData != null) { var agencydata = _AgencyIndividualService.GetAgencyIndividual(agencyJobData.AgencyIndividualId); if (agencydata == null) { var customerData = _CustomerService.GetCustomer(agencyJobData.AgencyIndividualId); Mapper.CreateMap <Customer, CustomerModel>(); CustomerModel agencyModel = Mapper.Map <Customer, CustomerModel>(customerData); details.customerModel = agencyModel; } else { Mapper.CreateMap <AgencyIndividual, AgencyIndividualModel>(); AgencyIndividualModel agencyModel = Mapper.Map <AgencyIndividual, AgencyIndividualModel>(agencydata); details.agencyIndividualModel = agencyModel; } } else { details.agencyIndividualModel = null; } //END:Get detail of job assign individual details.request = model; } return(View(details)); } else { return(RedirectToAction("LogOn", "Account")); } }