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); }
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); }
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); }
public bool delete(notes entity) { if (entity != null) { modelmovieContainer moviemodel = new modelmovieContainer(); if (moviemodel.notesSet.Remove(entity) != null) { moviemodel.SaveChanges(); return(true); } } return(false); }
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); }
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); }
public bool create(user entity) { if (entity != null) { modelmovieContainer moviemodel = new modelmovieContainer(); if (moviemodel.userSet.Add(entity) != null) { moviemodel.SaveChanges(); return(true); } } return(false); }
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); }
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); }
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); }
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); }
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); }
public List <comments> findByMovie(movie myMovie) { modelmovieContainer moviemodel = new modelmovieContainer(); return(moviemodel.commentsSet1.Where(entity => entity.movie == myMovie).ToList()); }