public HttpResponseMessage DeleteJobCategory(JobCategoryModel model) { try { if (this.ModelState.IsValid) { var result = _jobCategoryService.DeleteJobCategory(model); if (result != null) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } else { string message = "Not deleted successfully"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public ActionResult Create() { var model = new JobCategoryModel(); model.IsActive = true; return(View(model)); }
public HttpResponseMessage GetJobCategoryModels(JobCategoryModel model) { try { if (this.ModelState.IsValid) { var JobCategoryList = _jobCategoryService.GetAllJobCategoryList(model); if (JobCategoryList != null) { return(Request.CreateResponse(HttpStatusCode.OK, JobCategoryList)); } else { string message = "Error in getting Data"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message)); } }
public ActionResult Create(JobCategoryModel model) { if (ModelState.IsValid) { var jobCategory = new JobCategory { Name = model.Name, IsActive = model.IsActive }; var result = jobCategoryService.Insert(jobCategory); if (result) { this.NotifySuccess("Successfully saved."); } else { this.NotifyError("Item can not saved!"); } var urlRecord = new UrlRecord { EntityId = jobCategory.Id, EntityName = nameof(JobCategory), Slug = model.Name.ToUrlSlug() }; urlService.Save(urlRecord); return(RedirectToAction("Edit", new { Id = jobCategory.Id })); } return(View(model)); }
/// <summary> /// JobCategory Edit /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int?id) { if (!id.HasValue) { return(RedirectToAction("List")); } var jobCategory = jobCategoryService.GetById(id.Value); if (jobCategory == null) { this.NotifyError("Item not found."); return(RedirectToAction("List")); } var model = new JobCategoryModel { Id = jobCategory.Id, Name = jobCategory.Name, IsActive = jobCategory.IsActive, JobCount = jobService.GetCount(jobCategory.Id) }; return(View(model)); }
public ActionResult Edit(JobCategoryModel model) { if (ModelState.IsValid) { var jobCategory = jobCategoryService.GetById(model.Id); if (jobCategory == null) { this.NotifyError("Item not found."); return(RedirectToAction("List")); } else { jobCategory.Name = model.Name; jobCategory.IsActive = model.IsActive; var result = jobCategoryService.Update(jobCategory); if (result) { this.NotifySuccess("Successfully saved."); } else { this.NotifyError("Item can not saved!"); } urlService.Save(new UrlRecord() { EntityId = jobCategory.Id, EntityName = nameof(JobCategory), Slug = model.Name.ToUrlSlug() }); } return(RedirectToAction("Edit", new { id = model.Id })); } return(View(model)); }
public ActionResult Index(int?id, int?type) { cattype = type.GetValueOrDefault(); if (cattype != 0) { if (cattype == 2) { category = "G"; } else { category = "J"; } } else { GetCategory(); } Session["ExchangeRate"] = MatchBxCommon.GetExchangeRate(); TempData["TrendingTagsFooter"] = MatchBxCommon.GetTrendingTagsFooter(); MultipleModel modelMul = new MultipleModel(); int _loadmore = 0; JobCategoryId = id.GetValueOrDefault(); Session["JobCatId"] = JobCategoryId; dynamic model = new ExpandoObject(); objJob.JobCategoryId = JobCategoryId; objJob.FromPage = category; objJob.SortBy = "H"; if (Session["searchmodel"] != null && Session["FromDetails"] != null) { SearchCriteria _model = (SearchCriteria)Session["searchmodel"]; objJob.TrendingTagsIdList = _model.populartags; objJob.SkillsList = _model.topskills; ViewBag.budgetMin = _model.budgetMin; ViewBag.MaxBudget = _model.budgetMax; objJob.SortBy = _model.sortorder; Session["searchmodel"] = null; Session["FromDetails"] = null; } else { objJob.TrendingTagsIdList = "0"; objJob.SkillsList = "0"; } objJobList = MatchBxCommon.GenerateBadge(objJobMod.GetJobDetails(objJob).ToList().OrderByDescending(x => x.BudgetASP).ToList()); //objJobList = MatchBxCommon.GenerateBadge(objJobMod.GetJobDetails(objJob).ToList().OrderByDescending(x => x.BudgetASP).ThenByDescending(x => x.Rownumber).ToList()); TempData["JobList"] = objJobList; _TotalRecord = objJobList.Count(); if (_TotalRecord > _RecordDisplay) { _loadmore = 1; } else { _loadmore = 0; } objJobList.ForEach(s => s.Isloadmore = _loadmore); objJobList.ForEach(s => s.BudgetASPInt = Convert.ToInt32(s.BudgetASP)); model.Job = objJobList.Take(_RecordDisplay).ToList(); Session["Category"] = category; //if (category == "J") //{ // objJobList.ForEach(s => s.FromPage = "J"); // Session["Category"] = "J"; //} //else { // objJobList.ForEach(s => s.FromPage = "G"); // Session["Category"] = "G"; //} objTrending.JobCategoryId = JobCategoryId; objTrending.FromPage = category; objTrendingTagsList = objTrendingMod.GetTrendingTags(objTrending); model.TrendingTags = objTrendingTagsList; objTrendingTagsList.ForEach(s => s.Description = s.Description.Replace("#", "")); model.PopularTags = objTrendingTagsList; objSkills.JobCategoryId = JobCategoryId; Session["JobCategoryId"] = JobCategoryId; objSkills.FromPage = category; model.skills = objSkillsMod.GetTopSkills(objSkills); List <JobCategory> _JobcategoryList = new List <JobCategory>(); JobCategoryModel JobModel = new JobCategoryModel(); _JobcategoryList = JobModel.GetList(); Session["JobCategory"] = _JobcategoryList; model.messageSender = 0; if (Request.QueryString["mailMessagId"] != null) { string _messageSender = Request.QueryString["mailMessagId"].ToString(); model.messageSender = Convert.ToInt32(_messageSender); Session["mailMessagId"] = _messageSender; } return(View("Index", model)); }
public ActionResult Index(int?id) { if (Session["IsEmailAlready"] != null) { ViewBag.IsEmailAlready = "Y"; Session["IsEmailAlready"] = null; } else { //Session["IsEmailAlready"] = "N"; ViewBag.IsEmailAlready = "N"; Session["IsEmailAlready"] = null; } dynamic model = new ExpandoObject(); if (Session["FromDetails"] != null && Session["DynModel"] != null) { model = (dynamic)Session["DynModel"]; model.TopJobPosters = (List <Job>)Session["TopJobPosters"]; model.VerifiedPartners = (List <Job>)Session["VerifiedPartners"]; model.TrendingTags = (List <TrendingTags>)Session["TrendingTags"]; Session["FromDetails"] = null; Session["DynModel"] = null; } else { if (id.GetValueOrDefault() == 0) { objJob.TrendingTagsIdList = "0"; } else { objJob.TrendingTagsIdList = id.GetValueOrDefault().ToString(); ViewBag.CurrentTag = id.GetValueOrDefault().ToString(); } objJob.SkillsList = "0"; List <Job> _JobList = new List <Job>(); objJob.SortBy = "B"; GetCategory(); objJob.FromPage = category; //if (Session["UserId"] != null) //{ // objJob.FromPage = "J"; //} //else //{ // objJob.FromPage = "B"; //} _JobList = objJobMod.GetJobDetails(objJob).OrderByDescending(x => x.Rownumber).ToList(); if (_JobList.Count == 1) { ViewBag.MetaTag = HomeMetaTags(_JobList[0].JobTitle.ToString(), _JobList[0].JobDescription.ToString()); } else if (_JobList.Count > 1) { ViewBag.MetaTag = HomeMetaTags("Hire freelancers, pay in cryptocurrency", "Complete jobs to earn AXPR, or post a job and have great freelancers come to you"); } _TotalRecord = _JobList.Count(); if (_TotalRecord > _RecordDisplay) { _loadmore = 1; } else { _loadmore = 0; } _JobList.ForEach(x => x.Isloadmore = _loadmore); _JobList = _JobList.Take(_RecordDisplay).ToList(); model.Job = MatchBxCommon.GenerateBadge(_JobList); model.TopJobPosters = objJobMod.GetTopJobPosters(objJob); model.VerifiedPartners = objJobMod.GetVerifiedPartners(objJob); Session["TopJobPosters"] = model.TopJobPosters; //if (Session["UserId"] != null) //{ // objTrending.FromPage = "J"; //} //else //{ // objTrending.FromPage = "B"; //} // GetCategory(); objTrending.FromPage = category; model.TrendingTags = objTrendingMod.GetTrendingTags(objTrending); Session["TrendingTags"] = model.TrendingTags; Session["JobCategoryName"] = ""; Session["JobCategoryId"] = 0; //TempData["TrendingTagsFooter"] = MatchBxCommon.GetTrendingTagsFooter(); } List <JobCategory> _JobcategoryList = new List <JobCategory>(); JobCategoryModel JobModel = new JobCategoryModel(); _JobcategoryList = JobModel.GetList(); Session["JobCategory"] = _JobcategoryList; model.messageSender = 0; if (Request.QueryString["mailMessagId"] != null) { string _messageSender = Request.QueryString["mailMessagId"].ToString(); model.messageSender = Convert.ToInt32(_messageSender); Session["mailMessagId"] = _messageSender; } TempData["TrendingTagsFooter"] = MatchBxCommon.GetTrendingTagsFooter(objTrending.FromPage); return(View("Index", model)); }
public ActionResult GigFeedBackReview(int?GigReviewId) { if (Session["UserType"] == null || Session["UserType"].ToString() != "4") { //TempData["gigid"] = GigReviewId.GetValueOrDefault(); return(RedirectToAction("Index", "Jobs", new { @redirecturl = "Y" })); } else { JobCategoryModel objCatMod = new JobCategoryModel(); var categoryList = objCatMod.GetList(); dynamic model = new ExpandoObject(); categoryList.ForEach(c => { var lowerCase = c.Category.ToLower(); var r = new Regex(@"(^[a-z])|\.\s+(.)", RegexOptions.ExplicitCapture); c.Category = r.Replace(lowerCase, s => s.Value.ToUpper()); }); TempData["Category"] = categoryList; TempData["message"] = string.Empty; TempData["BlockReason"] = _objUsrBlockModel.GetList(); TempData["CancelJobReason"] = _ObjJobModel.GetJobCancelList(); GigReviewModel _GigReviewModel = new GigReviewModel(); Gig _Gig = new Gig(); _Gig.JobCategoryId = 0; _Gig.SortBy = "N"; List <GigReview> _GigReviewList = new List <GigReview>(); _GigReviewList = _GigReviewModel.GigReviewAdmin("N"); if (GigReviewId.GetValueOrDefault() != 0) { _GigReviewList = _GigReviewList.Where(x => x.GigId == GigReviewId.GetValueOrDefault()).ToList <GigReview>(); } if (_GigReviewList.Count > 0) { //foreach (Job _job in _GigList) //{ //_GigReviewList.ForEach(s => s.BudgetASPInt = Convert.ToInt32(s.BudgetASP)); // } //if (!String.IsNullOrEmpty(_searchtext)) //{ // _GigList = _GigList.Where(p => p.JobDescription != null && p.JobDescription.ToLower().Contains(_searchtext.ToLower().Trim()) || p.JobTitle != null && p.JobTitle.ToLower().Contains(_searchtext.ToLower().Trim()) || p.JobCompletionDateDisplay != null && p.JobCompletionDateDisplay.ToLower().Contains(_searchtext.ToLower()) || p.TrendingTagsIdList != null && p.TrendingTagsIdList.ToLower().Contains(_searchtext.ToLower())).ToList(); //} ReviewRecord = _GigReviewList.Count(); if (ReviewRecord > recordDisplay) { reviewloadmore = 1; } else { reviewloadmore = 0; } _GigReviewList.ForEach(x => x.Isloadmore = reviewloadmore); model.GigReview = _GigReviewList.Take(recordDisplay).ToList(); } else { model.GigReview = new List <GigReview>(); } return(View("GigFeedbackReview", model.GigReview)); } }
public PartialViewResult JobReview(int?jid) { TempData["message"] = string.Empty; dynamic model = new ExpandoObject(); JobCategoryModel objCatMod = new JobCategoryModel(); var categoryList = objCatMod.GetList(); categoryList.ForEach(c => { // start by converting entire string to lower case var lowerCase = c.Category.ToLower(); // matches the first sentence of a string, as well as subsequent sentences var r = new Regex(@"(^[a-z])|\.\s+(.)", RegexOptions.ExplicitCapture); // MatchEvaluator delegate defines replacement of setence starts to uppercase c.Category = r.Replace(lowerCase, s => s.Value.ToUpper()); }); TempData["Category"] = categoryList; TempData["CancelJobReason"] = _ObjJobModel.GetJobCancelList(); JobModel _JobModel = new JobModel(); Job _Job = new Job(); _Job.JobCategoryId = 0; _Job.SortBy = "N"; List <Job> _JobList = MatchBxCommon.GenerateBadge(_JobModel.GetJobReview(_Job)); if (jid.GetValueOrDefault() != 0) { _JobList = _JobList.Where(x => x.JobId == jid.GetValueOrDefault()).ToList(); } foreach (Job _job in _JobList) { _JobList.ForEach(s => s.BudgetASPInt = Convert.ToInt32(s.BudgetASP)); _JobList.ForEach(s => s.EndsIn = (s.JobCompletionDate.Subtract(DateTime.Now)).Days + " days, " + (s.JobCompletionDate.Subtract(DateTime.Now)).Hours + " hours"); } var objJobListFiltered = _JobList.GroupBy(x => x.JobId).Select(y => y.First()).ToList(); ReviewRecord = objJobListFiltered.Count(); if (ReviewRecord > recordDisplay) { reviewloadmore = 1; } else { reviewloadmore = 0; } objJobListFiltered.ForEach(s => s.Isloadmore = reviewloadmore); if (_JobList.Count() == 0 && jid.GetValueOrDefault() != 0) { JobModel jobmodel = new JobModel(); Job obj = jobmodel.GetARecord(jid.GetValueOrDefault()); if (obj != null) { TempData["message"] = obj.JobStatus != "F" ? "This job is already approved" : "This job is already rejected"; } else { TempData["message"] = "This job does not exist"; } } model.JobReview = objJobListFiltered.OrderByDescending(x => x.JobId).Take(recordDisplay).ToList(); return(PartialView("JobReview", model.JobReview)); }