public Student_Mast getStudentByID()
        {
            Student_Mast student = db.Student_Mast
                                   .Where(i => i.StudID == 1).FirstOrDefault();

            return(student);
        }
예제 #2
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());
        }
        // 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());
        }