public ActionResult Create([Bind(Include = "fname,lname,phone,mailid,pwd")] user user) { if (ModelState.IsValid) { db.users.Add(user); db.SaveChanges(); Session["message"] = user.fname + " " + user.lname + " " + "Succesfully Registered "; return(RedirectToAction("Create")); } return(View()); }
public ActionResult HirerPage([Bind(Include = "jobtitle,publishby,jobdesp,exp,tech,prevcom,date")] Jobpost obj) { if (ModelState.IsValid) { db.Jobposts.Add(obj); try { db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); } Session["job"] = "job posted successfully"; return(RedirectToAction("HirerPage")); } return(View(obj)); }
public bool Del(int id) { var societe = GetSocieteById(id); using (var db = new modelEntities1()) { db.Societe.Attach(societe); db.Societe.Remove(societe); db.SaveChanges(); return(true); } }
public void Update(Societe societe) { using (var db = new modelEntities1()) { var original = db.Societe.Find(societe.Id); if (original != null) { db.Entry(original).CurrentValues.SetValues(societe); db.SaveChanges(); } } }
public Societe Add(Societe c) { var newSociete = new Societe { //Id = c.Id, Nom = c.Nom, Guid = c.Guid, CodePostal = c.CodePostal, AdresseLigne1 = c.AdresseLigne1, AdresseLigne2 = c.AdresseLigne2, Ville = c.Ville, }; using (var db = new modelEntities1()) { db.Societe.Add(newSociete); db.SaveChanges(); } return(newSociete); }