Esempio n. 1
0
 public List <user> findall()
 {
     try
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         return(moviemodel.userSet.ToList <user>());
     } catch (Exception e)
     {
         Console.WriteLine("{0} Exception caught.", e);
     }
     return(null);
 }
Esempio n. 2
0
 public comments findById(int id)
 {
     try
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         return(moviemodel.commentsSet.First(item => item.Id == id));
     }
     catch (Exception e)
     {
         Console.WriteLine("{0} Exception caught.", e);
     }
     return(null);
 }
Esempio n. 3
0
 public movie findByName(String title)
 {
     try
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         return(moviemodel.movieSet.First(item => item.title == title));
     }
     catch (Exception e)
     {
         Console.WriteLine("{0} Exception caught.", e);
     }
     return(null);
 }
Esempio n. 4
0
 public bool delete(notes entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         if (moviemodel.notesSet.Remove(entity) != null)
         {
             moviemodel.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
 public bool edit(user entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         user result = (from res in moviemodel.userSet where res.Id == entity.Id select res).SingleOrDefault();
         result.password = entity.password;
         result.username = entity.username;
         moviemodel.SaveChanges();
         return(true);
     }
     return(false);
 }
Esempio n. 6
0
 public user findByName(String name)
 {
     try
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         return(moviemodel.userSet.First(item => item.username == name));
     }
     catch (Exception e)
     {
         Console.WriteLine("{0} Exception caught.", e);
     }
     return(null);
 }
Esempio n. 7
0
 public bool create(user entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         if (moviemodel.userSet.Add(entity) != null)
         {
             moviemodel.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
Esempio n. 8
0
 public bool edit(notes entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         notes result = (from res in moviemodel.notesSet where res.Id == entity.Id select res).SingleOrDefault();
         result.note  = entity.note;
         result.user  = entity.user;
         result.movie = entity.movie;
         moviemodel.SaveChanges();
         return(true);
     }
     return(false);
 }
Esempio n. 9
0
 public bool create(comments entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         if (moviemodel.commentsSet.Add(entity) != null)
         {
             if (moviemodel.SaveChanges() > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 10
0
 public bool edit(comments entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         comments            result     = (from res in moviemodel.commentsSet where res.Id == entity.Id select res).SingleOrDefault();
         result.comment = entity.comment;
         result.user    = entity.user;
         result.movie   = entity.movie;
         if (moviemodel.SaveChanges() > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 11
0
        public bool create(user entity)
        {
            if (entity != null)
            {
                modelmovieContainer moviemodel = new modelmovieContainer();

                if (moviemodel.userSet.Add(entity) != null)
                {
                    if (moviemodel.SaveChanges() > 0) // Car retourne zero si rien n'a été ajouté
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 12
0
 public bool edit(movie entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         movie result = (from res in moviemodel.movieSet where res.Id == entity.Id select res).SingleOrDefault();
         result.title      = entity.title;
         result.category   = entity.category;
         result.synopsys   = entity.synopsys;
         result.actors     = entity.actors;
         result.date       = entity.date;
         result.productors = entity.productors;
         if (moviemodel.SaveChanges() > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 13
0
        public List <comments> findByMovie(movie myMovie)
        {
            modelmovieContainer moviemodel = new modelmovieContainer();

            return(moviemodel.commentsSet1.Where(entity => entity.movie == myMovie).ToList());
        }