public void SaveOffer(Offer offer) { Offer dbEntry = db.Offers.Find(offer.OfferId); if (dbEntry != null) { dbEntry.Title = offer.Title; dbEntry.ReferenceNumber = offer.ReferenceNumber; dbEntry.DailyWorkTime = offer.DailyWorkTime; dbEntry.Description = offer.Description; dbEntry.OfferType = offer.OfferType; dbEntry.OfferLevel = offer.OfferLevel; dbEntry.Salary = offer.Salary; foreach (string t in offer.MainTechnologies) { dbEntry.MainTechnologies.Add(t); } foreach (string t in offer.AdditionalTechnologies) { dbEntry.AdditionalTechnologies.Add(t); } } db.SaveChanges(); }
public ActionResult AddOffer(Offer offer) { if (ModelState.IsValid) { offer.Employer = db.Employers.FirstOrDefault(x => x.UserId == WebSecurity.CurrentUserId); db.Offers.Add(offer); db.SaveChanges(); return RedirectToAction("Profile", "Employer"); } return View(offer); }
public void AddOffer(string employerId) { Offer offer = new Offer(); offer.EmployerId = employerId; offer.Title = ""; offer.ReferenceNumber = ""; offer.DailyWorkTime = new WorkTime(); offer.Description = ""; offer.OfferType = new Occupie.Enums.OfferType(); offer.OfferLevel = new Level(); offer.MainTechnologies = new List<string>(); db.Offers.Add(offer); db.SaveChanges(); }
public ActionResult Edit(Offer offer) { if (ModelState.IsValid) { db.Entry(offer).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Details", "Offer", new { id = offer.OfferId }); } return View(offer); }