예제 #1
0
 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());
 }
예제 #2
0
 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));
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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();
                }
            }
        }
예제 #5
0
        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);
        }