예제 #1
0
        public ActionResult Create([Bind(Include = "ID,Name,Gender,Birthday")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "ID,Nota,Subject,Estado")] Note note)
        {
            if (ModelState.IsValid)
            {
                db.Notes.Add(note);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(note));
        }
        //Delete Data Start From Here...
        public IActionResult DeleteParentNode(int id)
        {
            //Delete Data From Control Account
            var found   = _db.GL_CONTROL_ACCOUNTs.Find(id);
            var c       = _db.GL_CONTROL_ACCOUNTs.Where(x => x.PARENT_CONTROL_ACCOUNT_ID == found.CHART_OF_ACCOUNT_ID).Count();
            var C_Count = _db.GL_CHART_OF_ACCOUNTs.Where(x => x.GL_C_ACCOUNT_id == found.CHART_OF_ACCOUNT_ID).Count();

            if (found != null && c == 0 && C_Count == 0)
            {
                _db.GL_CONTROL_ACCOUNTs.Remove(found);
                _db.SaveChanges();
            }
            return(new JsonResult("Delete Successfully"));
            //return Redirect("/Home/ChartAccountsList");
        }
예제 #4
0
 virtual public void Update_Item(t Item)
 {
     context.Entry <t>(Item).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }