Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            banji banji = db.banji.Find(id);

            db.banji.Remove(banji);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "name,id,Teacherid")] banji banji)
 {
     if (ModelState.IsValid)
     {
         db.Entry(banji).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(banji));
 }
Exemple #3
0
        public ActionResult Create([Bind(Include = "name,id,Teacherid")] banji banji)
        {
            if (ModelState.IsValid)
            {
                db.banji.Add(banji);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(banji));
        }
Exemple #4
0
        public ActionResult delclass(int id)
        {
            banji del = new banji()
            {
                classId = id
            };

            db.banji.Attach(del);
            db.banji.Remove(del);
            db.SaveChanges();
            return(Json(new object()));
        }
Exemple #5
0
        // GET: banji/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            banji banji = db.banji.Find(id);

            if (banji == null)
            {
                return(HttpNotFound());
            }
            return(View(banji));
        }
Exemple #6
0
        // GET: banji/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var teacher = db.teacher.ToList();

            ViewBag.Teacher = teacher;
            banji banji = db.banji.Find(id);

            if (banji == null)
            {
                return(HttpNotFound());
            }
            return(View(banji));
        }
Exemple #7
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_schoolName = false;
            bool   isset_age        = false;
            bool   isset_zhuanye    = false;
            bool   isset_allBanji   = false;
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        SchoolName       = iprot.ReadString();
                        isset_schoolName = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I64)
                    {
                        Age       = iprot.ReadI64();
                        isset_age = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            Zhuanye = new List <string>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                string _elem2;
                                _elem2 = iprot.ReadString();
                                Zhuanye.Add(_elem2);
                            }
                            iprot.ReadListEnd();
                        }
                        isset_zhuanye = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.List)
                    {
                        {
                            AllBanji = new List <banji>();
                            TList _list3 = iprot.ReadListBegin();
                            for (int _i4 = 0; _i4 < _list3.Count; ++_i4)
                            {
                                banji _elem5;
                                _elem5 = new banji();
                                _elem5.Read(iprot);
                                AllBanji.Add(_elem5);
                            }
                            iprot.ReadListEnd();
                        }
                        isset_allBanji = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_schoolName)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA, "required field SchoolName not set");
            }
            if (!isset_age)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Age not set");
            }
            if (!isset_zhuanye)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Zhuanye not set");
            }
            if (!isset_allBanji)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA, "required field AllBanji not set");
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }