示例#1
0
        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");
        }
示例#2
0
        public ActionResult Edit(employee emp)
        {
            StudentdbEntities db = new StudentdbEntities();

            db.Entry(emp).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Create(employee emp)
        {
            StudentdbEntities db = new StudentdbEntities();

            db.employees.Add(emp);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
        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());
        }