コード例 #1
0
 public GetFilmsResult GetAll()
 {
     try
     {
         using (var sqlConnection = new SqlConnection(_connectionString))
         {
             sqlConnection.Open();
             var films = sqlConnection.Query <FilmEntity>("SELECT [Title],[Year] FROM [dbo].[Films]");
             return(GetFilmsResult.Success(films));
         }
     }
     catch (Exception)
     {
         return(GetFilmsResult.Unsuccessful());
     }
 }
コード例 #2
0
 private static IEnumerable <Film> Wishlist(GetFilmsResult result) => result.Result == RepositoryResult.Failed ? EmptyFilmsList() : FilmsFromEntities(result.Value);
コード例 #3
0
 private AddFilmResult AddFilmUnlessFilmsCannotBeRetrieved(string title, int year, GetFilmsResult getFilmsResult) =>
 getFilmsResult.Result == RepositoryResult.Failed
         ? AddFilmResult.Failed
         : AddFilmUnlessDuplicate(title, year, getFilmsResult.Value);