public ActionResult Delete(int?id, studentlist stdd)
        {
            try
            {
                studentlist std = db.studentlists.Find(id);
                if (ModelState.IsValid)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }

                    if (std == null)
                    {
                        return(HttpNotFound());
                    }
                    db.studentlists.Remove(std);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                return(View(std));
            }
            catch
            {
                return(View());
            }
        }
Example #2
0
		static void Main(string[] args)
		{

			studentslist studentlist = new studentlist();

            studentlist.Run();

		}
        // GET: studentlist/Edit/5

        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            studentlist std = db.studentlists.Find(id);

            if (std == null)
            {
                return(HttpNotFound());
            }
            return(View(std));
        }
 public ActionResult Edit(studentlist std)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(std).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(std));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Create(studentlist std)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.studentlists.Add(std);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View(std));
            }
            catch
            {
                return(View());
            }
        }