Пример #1
0
        private List <MovieMetaDataModel> GetMovieMetaDataModelsFromFile()
        {
            var fileSavePath = Path.Combine("Data", "metadata.csv");

            if (!File.Exists(fileSavePath))
            {
                return(new List <MovieMetaDataModel>());
            }

            var dataRows = FileHelper.GetDataFromFile(fileSavePath);

            if (dataRows.Any())
            {
                var list = new List <MovieMetaDataModel>();
                foreach (var item in dataRows)
                {
                    var element = new MovieMetaDataModel();
                    element.duration    = item["duration"].ToString();
                    element.language    = item["language"].ToString();
                    element.movieId     = int.Parse(item["movieId"].ToString());
                    element.releaseYear = int.Parse(item["releaseYear"].ToString());
                    element.title       = item["title"].ToString();
                    list.Add(element);
                }

                return(list);
            }
            return(new List <MovieMetaDataModel>());
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 public void CreateMovieMetaDataModel(MovieMetaDataModel model)
 {
     movieMetaDataModels.Add(model);
 }
Пример #3
0
 public void Post([FromBody] MovieMetaDataModel model)
 {
     MoviceService.CreateMovieMetaDataModel(model);
 }