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(); }
public HttpResponseMessage Post([FromBody] emp em) { context.emps.Add(em); context.SaveChanges(); HttpResponseMessage message = new HttpResponseMessage(); message.ReasonPhrase = "Created.."; return(message); }
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()); } }
public ActionResult AddNew(emp em) { context.emps.Add(em); context.SaveChanges(); return(RedirectToAction("ShowAll")); }