public String PostStudent(tblStudent student) { sdb.tblStudents.Add(student); String data = "Insert Student Data on" + DateTime.Now.ToString(); sdb.SaveChanges(); File.AppendAllText(HttpContext.Current.Server.MapPath("~/Log.txt"), data + "\n"); return("Data Added Successfully"); }
public ActionResult Edit(employee emp) { StudentdbEntities db = new StudentdbEntities(); db.Entry(emp).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(employee emp) { StudentdbEntities db = new StudentdbEntities(); db.employees.Add(emp); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { StudentdbEntities db = new StudentdbEntities(); if (id != null) { employee emp = db.employees.Find(id); db.employees.Remove(emp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }