public ActionResult ExpUpdate(workExperience exp) { workExperience wp = db.WorkExperiences.Where(w => w.ID == exp.ID).FirstOrDefault(); wp.Company = exp.Company; wp.Country = exp.Country; wp.Description = exp.Description; wp.FromYear = exp.FromYear; wp.ToYear = exp.ToYear; wp.Title = exp.Title; string email = (string)Session["email"]; ServiceProvider sp = new ServiceProvider(); sp = db.ServiceProviders.Where(s => s.Email == email).FirstOrDefault(); workExperience wx = sp.workExperiences.Where(e => e.ID == exp.ID).FirstOrDefault(); wx.Company = exp.Company; wx.Country = exp.Country; wx.Description = exp.Description; wx.FromYear = exp.FromYear; wx.ToYear = exp.ToYear; wx.Title = exp.Title; db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> ExpUpdate(int id) { ViewBag.photoLink = await getPicLink(); workExperience exp = db.WorkExperiences.Find(id); return(View(exp)); }
public ActionResult ExpDelete(int id) { workExperience wp = db.WorkExperiences.Find(id); db.WorkExperiences.Remove(wp); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ExpCreate(workExperience exp) { if (ModelState.IsValid) { string email = (string)Session["email"]; ServiceProvider sp = new ServiceProvider(); sp = db.ServiceProviders.Where(s => s.Email == email).FirstOrDefault(); exp.ServiceProvider = sp; sp.workExperiences.Add(exp); db.WorkExperiences.Add(exp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(exp)); }