Ejemplo n.º 1
0
 public IHttpActionResult update(profile p)
 {
     using (var db = new annuEntities2())
     {
         var pro = (from pr in db.profiles where p.id == pr.id select pr).FirstOrDefault();
         pro.email    = p.email;
         pro.password = p.password;
         db.SaveChanges();
     }
     return(Ok());
 }
Ejemplo n.º 2
0
        public IHttpActionResult delete(int id)
        {
            profile p = new profile();

            p.id = id;
            using (var db = new annuEntities2())
            {
                var pro = (from pr in db.profiles where p.id == pr.id select pr).FirstOrDefault();
                db.profiles.Remove(pro);
                db.SaveChanges();
            }
            return(Ok());
        }
Ejemplo n.º 3
0
 public IHttpActionResult postempolyee(profile pro)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("invalid model"));
     }
     using (var db = new annuEntities2())
     {
         db.profiles.Add(new profile()
         {
             email    = pro.email,
             password = pro.password
         });
         db.SaveChanges();
     }
     return(Ok("student added"));
 }