Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            emp em = new emp();

            em.code   = 100;
            em.name   = "Mahesh";
            em.salary = 23000;
            em.deptid = 101;

            context.emps.Add(em);
            context.SaveChanges();

            FillGrid();
        }
Exemple #2
0
        public HttpResponseMessage Post([FromBody] emp em)
        {
            context.emps.Add(em);
            context.SaveChanges();
            HttpResponseMessage message = new HttpResponseMessage();

            message.ReasonPhrase = "Created..";
            return(message);
        }
Exemple #3
0
 public IHttpActionResult AddUser(UserClass uc)
 {
     using (newdbEntities _db = new newdbEntities())
     {
         _db.Users.Add(new User()
         {
             UserName = uc.Username,
             Email    = uc.Email,
             Password = uc.Password,
             Phone    = uc.Phone
         });
         _db.SaveChanges();
         return(Ok());
     }
 }
Exemple #4
0
 public ActionResult AddNew(emp em)
 {
     context.emps.Add(em);
     context.SaveChanges();
     return(RedirectToAction("ShowAll"));
 }