Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Stdent stdent = db.Stdent.Find(id);

            db.Stdent.Remove(stdent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Classid")] Stdent stdent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stdent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stdent));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,Name,Classid")] Stdent stdent)
        {
            if (ModelState.IsValid)
            {
                db.Stdent.Add(stdent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(stdent));
        }
Ejemplo n.º 4
0
        // GET: Stdent/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Stdent stdent = db.Stdent.Find(id);

            if (stdent == null)
            {
                return(HttpNotFound());
            }
            return(View(stdent));
        }
Ejemplo n.º 5
0
        public static void input_Parent_Stdent()
        {
            start : try
            {
                Console.WriteLine("\tParent Please Put Your Name:");
                string Name = Console.ReadLine();
                Console.WriteLine("\tParent Please Put Your Phone:");
                string Phone = Console.ReadLine();
                Parent p1    = new Parent(Name, Phone);
                Console.WriteLine("_________________");
                Console.WriteLine("\tStdent Please Put Your Name:");
                string NameStdent = Console.ReadLine();
                Console.WriteLine("\tStdent Please Put Your Age:");
                int    AgeStdent = int.Parse(Console.ReadLine());
                Stdent s1        = new Stdent(AgeStdent, NameStdent, p1);
                Console.WriteLine("\n" + p1);
                Console.WriteLine("____________");
                Console.WriteLine(s1);
            }
            catch (Exception)
            {
to_try:
                Console.WriteLine("Somting Worng!");
                Console.WriteLine("You Want To try Again (Y/N)?");
                char check = char.Parse(Console.ReadLine());
                if (check == 'y' || check == 'Y')
                {
                    goto start;
                }
                if (check == 'N' || check == 'n')
                {
                    Console.WriteLine("END");
                }
                else
                {
                    goto to_try;
                }
            }
        }