//this method enables admin to post jobs which is stored in the database public string CreateJobOffer(PostJobViewModel jobViewModel, string userId) { string result = ""; try { JobOffers newJobOffers = new JobOffers() { Title = jobViewModel.JobTitle, AplicationDetails = jobViewModel.JobDetails, Deadline = jobViewModel.Deadline, DateCreated = DateTime.Now, Position = jobViewModel.Position, NoOfApplicant = jobViewModel.NumApplicant, AplicationRequirement = jobViewModel.Requirements, Image = JobApplicationServices.ConvertToByte(jobViewModel.AppImage), UserId = userId }; dbContext.jobOffers.Add(newJobOffers); dbContext.SaveChanges(); result = "Success"; } catch (Exception e) { result = "Error: " + e.Message; } return(result); }
public AjaxResult JobOffersListSave(JobOffers model) { JobOffers ent = db.JobOffers.FirstOrDefault(m => m.Id == model.Id); if (ent == null) { ent = model; ent.CreateTime = DateTime.Now; ent.IsActive = 1; db.JobOffers.Add(ent); } else { ent.Name = model.Name; ent.Position = model.Position; ent.Task = model.Task; ent.Count = model.Count; ent.Time = model.Time; ent.CreateTime = DateTime.Now; } int r = db.SaveChanges(); if (r <= 0) { return(new AjaxResult("保存失败")); } return(new AjaxResult("保存成功", 0)); }
public ActionResult JobOffersEdit(int?id) { var ent = _JobOffersManager.GetJobOffersById(id); if (ent == null) { ent = new JobOffers(); } return(View(ent)); }
public CompanyJobOffersView(Company company) { Info = new CompanyInfoViewModel(company); CompanyID = company.ID; foreach (var jobOffer in company.JobOffers) { var shortJobOfferVM = createShortJobOffer(jobOffer, (WorkTypeEnum)company.WorkTypeID, Info.CompanyRights); JobOffers.Add(shortJobOfferVM); } }
public async Task CreateAsync(int jobPostId, string description, string applicationUserId, string userUsername) { var jobOffer = new JobOffers { JobPostsId = jobPostId, Description = description, UserId = applicationUserId, UserUsername = userUsername, }; await this.jobOffersRepo.AddAsync(jobOffer); await this.jobOffersRepo.SaveChangesAsync(); }
public JsonResult JobOffersListSave(JobOffers model) { var r = _JobOffersManager.JobOffersListSave(model); return(Json(r)); }