public IList <MediaDTO> Search(string title = null, string genre = null, string director = null, string language = null, int?year = null) { IDictionary <string, object> conditions = new Dictionary <string, object>(); if (title != null) { conditions["Title"] = title; } if (genre != null) { conditions["GenreName"] = genre; } if (director != null) { conditions["DirectorName"] = director; } if (language != null) { conditions["LanguageName"] = language; } if (year != null) { if (year > 0) { conditions["PublishYear"] = year; } } return(Translate(CrudFunctions.Read(view, conditions, true))); }
private static bool Exists(string field, string value) { IDictionary <string, object> Parameters = new Dictionary <string, object>(); Parameters[field] = value; return(CrudFunctions.Read(table, Parameters).Rows.Count > 0); }
public MediaDTO FindByID(int iD) { IDictionary <string, object> conditions = new Dictionary <string, object>(); conditions["MediaID"] = iD; IList <MediaDTO> results = Translate(CrudFunctions.Read(view, conditions)); return(results[0]); }
public IList <UserDTO> ListUsers(int?id = null) { IDictionary <string, object> Parameters = new Dictionary <string, object>(); if (id != null) { Parameters["UID"] = id; } else { Parameters["1"] = 1; } return(Translate(CrudFunctions.Read(table, Parameters))); }
public IList <GenreDTO> GetGenres(int?iD = null) { IDictionary <string, object> conditions = new Dictionary <string, object>(); if (iD != null) { conditions["GID"] = iD; } else { conditions["1"] = 1; } return((IList <GenreDTO>)TranslateGenre(CrudFunctions.Read(genre, conditions))); }
public IList <DirectorDTO> GetDirectors(int?iD = null) { IDictionary <string, object> conditions = new Dictionary <string, object>(); if (iD != null) { conditions["DID"] = iD; } else { conditions["1"] = 1; } return((IList <DirectorDTO>)TranslateDirector(CrudFunctions.Read(director, conditions))); }
public IList <LanguageDTO> GetLanguages(int?iD = null) { IDictionary <string, object> conditions = new Dictionary <string, object>(); if (iD != null) { conditions["LID"] = iD; } else { conditions["1"] = 1; } return((IList <LanguageDTO>)TranslateLanguage(CrudFunctions.Read(language, conditions))); }
public UserDTO ValidateUser(string username, string password) { IDictionary <string, object> Parameters = new Dictionary <string, object>(); Parameters["UserName"] = username; Parameters["Password"] = password; DataTable Results = CrudFunctions.Read(table, Parameters); if (Results.Rows.Count > 0) { return(Translate(Results.Rows[0])); } else { throw new Exceptions.ValidationException("Username or Password was incorrect"); } }
public IList <BorrowDTO> GetBorrowed(int?bID = null, int?uID = null, int?MediaID = null) { IDictionary <string, object> conditions = new Dictionary <string, object>(); if (bID != null) { conditions["BID"] = bID; } if (uID != null) { conditions["UID"] = uID; } if (MediaID != null) { conditions["MediaID"] = MediaID; } if (conditions.Count <= 0) { conditions["1"] = 1; } return((IList <BorrowDTO>)TranslateBorrowed(CrudFunctions.Read(borrow, conditions))); }