Example #1
0
        public void InsertCategory(category pobj)
        {
            sakilaEntities bd = new sakilaEntities();

            bd.category.Add(pobj);
            bd.SaveChanges();
        }
Example #2
0
 public void Fetch2()
 {
     using (var ctx = new sakilaEntities())
     {
         var studentList = ctx.actors
                           .SqlQuery("SELECT * FROM sakila.actor Where last_name = 'CHASE'")
                           .ToList <actor>();
     }
 }
Example #3
0
        //CRUD methods here Ctrl + .
        public void DeleteCategory(int id)
        {
            sakilaEntities bd    = new sakilaEntities();
            var            query = (from cat in bd.category
                                    where cat.category_id == id
                                    select cat).FirstOrDefault();

            bd.category.Remove(query);
            bd.SaveChanges();
        }
Example #4
0
        public void UpdateCategory(category pobj)
        {
            sakilaEntities bd    = new sakilaEntities();
            var            query = (from cat in bd.category
                                    where cat.category_id == pobj.category_id
                                    select cat).FirstOrDefault();

            query.name        = pobj.name;
            query.last_update = pobj.last_update;
            bd.SaveChanges();
        }
Example #5
0
    public JsonResult GetData()
    {
        List <ActorModel> actormodel = new List <ActorModel>();

        using (var context = new sakilaEntities())
        {
            List <actor> b = context.actors.ToList();
            actormodel.Add(new ActorModel()
            {
                id          = 1,
                f_name      = "MS",
                l_name      = "Vivek",
                last_update = DateTime.Now
            });
        }
        return(Json(actormodel.ToList(), JsonRequestBehavior.AllowGet));
    }
Example #6
0
        public ActionResult List()
        {
            var List = new sakilaEntities().actors.ToList();

            return(View(List));
        }
Example #7
0
 public void TestGetFilms()
 {
     using (Bovril.EntityFramework.Sakila.sakilaEntities context = new sakilaEntities()) {
         Bovril.EntityFramework.Sakila.film[] films = context.films.ToArray();
     }
 }