コード例 #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);
 }
コード例 #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);
 }
コード例 #3
0
ファイル: MovieDao.cs プロジェクト: nmcodes/movie_net
 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);
 }
コード例 #4
0
ファイル: NotesDao.cs プロジェクト: nmcodes/movie_net
 public bool delete(notes entity)
 {
     if (entity != null)
     {
         modelmovieContainer moviemodel = new modelmovieContainer();
         if (moviemodel.notesSet.Remove(entity) != null)
         {
             moviemodel.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #8
0
ファイル: NotesDao.cs プロジェクト: nmcodes/movie_net
 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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
        }
コード例 #12
0
ファイル: MovieDao.cs プロジェクト: nmcodes/movie_net
 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);
 }
コード例 #13
0
ファイル: CommentsDao.cs プロジェクト: nmcodes/movie_net
        public List <comments> findByMovie(movie myMovie)
        {
            modelmovieContainer moviemodel = new modelmovieContainer();

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