Exemplo n.º 1
0
        public int DeleteContent(int contentId)
        {
            var contx = new MATH_ACADEMY_DBEntities();
            var old   = contx.Contents.Where(x => x.Id == contentId).FirstOrDefault();

            contx.Contents.Remove(old);
            return(contx.SaveChanges());
        }
Exemplo n.º 2
0
        public int EditCourse(Cours cours)
        {
            var ctx = new MATH_ACADEMY_DBEntities();
            var old = ctx.Courses.Where(x => x.Id == cours.Id).FirstOrDefault();

            if (old != null)
            {
                old.Name = cours.Name;
            }
            return(ctx.SaveChanges());
        }
Exemplo n.º 3
0
        public int EditContent(Content content)
        {
            var contx = new MATH_ACADEMY_DBEntities();
            var old   = contx.Contents.Where(x => x.Id == content.Id).FirstOrDefault();

            if (old != null)
            {
                old.Title = content.Title;
                old.Text  = content.Text;
                old.Video = content.Video;
            }
            return(contx.SaveChanges());
        }
Exemplo n.º 4
0
        public bool CreateCourse(Cours cours)
        {
            var ctx = new MATH_ACADEMY_DBEntities();

            ctx.Courses.Add(cours);
            try
            {
                ctx.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public bool CreateContent(Content content)
        {
            var contx = new MATH_ACADEMY_DBEntities();

            contx.Contents.Add(content);
            contx.SaveChanges();
            return(true);

            /*try
             * {
             *  contx.SaveChanges();
             *  return true;
             * }
             * catch(Exception ex)
             * {
             *  return false;
             * }*/
        }
Exemplo n.º 6
0
        public Content GetContent(int ContentId)
        {
            var contx = new MATH_ACADEMY_DBEntities();

            return(contx.Contents.Where(x => x.Id == ContentId).FirstOrDefault());
        }
Exemplo n.º 7
0
        public Cours GetCourse(int courseId)
        {
            var ctx = new MATH_ACADEMY_DBEntities();

            return(ctx.Courses.Where(x => x.Id == courseId).FirstOrDefault());
        }
Exemplo n.º 8
0
        public Content[] GetContents()
        {
            var contx = new MATH_ACADEMY_DBEntities();

            return(contx.Contents.ToArray());
        }
Exemplo n.º 9
0
        public Cours[] GetCourses()
        {
            var ctx = new MATH_ACADEMY_DBEntities();

            return(ctx.Courses.ToArray());
        }