Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "ID,StudentName,Age,ClassID,Phone,Sex,EnrollmentDate")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClassID = new SelectList(db.Classes, "ID", "ClassName", student.ClassID);
            return(View(student));
        }
Ejemplo n.º 2
0
        public ActionResult Create(TblPerson tblPerson)
        {
            if (ModelState.IsValid)
            {
                //db.Fun_InsertPerson(null, tblPerson.Name, tblPerson.Email, tblPerson.Mobile, tblPerson.Course, tblPerson.Percentage, tblPerson.Address, tblPerson.City);
                db.TblPersons.Add(tblPerson);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            List <TblCity> list = new List <TblCity>();

            list         = db.Fun_ViewCity().ToList();
            ViewBag.City = new SelectList(list, "CityId", "CityName");
            return(View());
        }
Ejemplo n.º 3
0
        // GET: Update
        public ActionResult Index()
        {
            Student_Mast model = new Student_Mast();

            model            = _bal.getStudentByID();
            model.First_Name = "Hardik";
            model.Last_Name  = "Gondalia";
            db.SaveChanges();
            return(View());
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeleteOrderSummary(int id)
        {
            var Order       = db.OrderSummaries.Where(x => x.OrderId == id);
            var OrderDetail = db.OrderDetails.Where(x => x.OrderId == id);

            if (Order == null)
            {
                return(NotFound());
            }
            db.OrderSummaries.RemoveRange(Order);
            db.OrderDetails.RemoveRange(OrderDetail);
            db.SaveChanges();
            return(Ok(id));
        }
        // GET: DemoEntity
        public ActionResult Index()
        {
            try
            {
                var students = db.GetStudentByID(1).ToList();

                Student_Mast model = new Student_Mast();
                model.First_Name = "John";
                model.Last_Name  = "Abraham";
                model.Roll_No    = 2;
                db.Student_Mast.Add(model);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View());
        }