Ejemplo n.º 1
0
        public ActionResult SysSchoolDelete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sys_School sys_School = db.Sys_Schools.Find(id);

            if (sys_School == null)
            {
                return(HttpNotFound());
            }
            sys_School.delete_flag     = 1;
            db.Entry(sys_School).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("SysSchoolList"));
        }
Ejemplo n.º 2
0
 public ActionResult SchoolEdit(ViewSysSchool viewSchool)
 {
     if (ModelState.IsValid)
     {
         Sys_School sys_School = new Sys_School();
         sys_School.sys_school_address = viewSchool.address;
         sys_School.sys_school_info    = viewSchool.introduce;
         sys_School.sys_school_name    = viewSchool.name;
         sys_School.sys_school_phone   = viewSchool.phone;
         if (viewSchool.id != null && viewSchool.id != 0)
         {
             sys_School.sys_school_id   = (int)viewSchool.id;
             db.Entry(sys_School).State = EntityState.Modified;
         }
         else
         {
             db.Sys_Schools.Add(sys_School);
         }
         db.SaveChanges();
         return(RedirectToAction("SysSchool", new { id = sys_School.sys_school_id }));
     }
     return(View(viewSchool));
 }