Ejemplo n.º 1
0
        public MovieTitles Parse(MovieTitlesModel model)
        {
            try
            {
                var title = new MovieTitles();

                if (model.MovieTitle != null)
                {
                    title.MovieTitle = model.MovieTitle;
                    if (model.MovieDesc != null)
                    {
                        title.MovieDesc = model.MovieDesc;
                    }

                    if (model.ImdbUrl != null)
                    {
                        title.ImdbUrl = model.ImdbUrl;
                    }

                    if (model.ReleaseDate != null)
                    {
                        title.ReleaseDt = model.ReleaseDate;
                    }

                    title.DateAdded    = DateTime.Now;
                    title.DateModified = DateTime.Now;

                    return(title);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public MovieTitles ParsePatch(MovieTitlesModel model, int id)
        {
            try
            {
                MovieTitles title = this.movieRepository.GetTitleForMovie(id);

                if (model.MovieTitle != null)
                {
                    title.MovieTitle = model.MovieTitle;
                    if (model.MovieDesc != null)
                    {
                        title.MovieDesc = model.MovieDesc;
                    }

                    if (model.ImdbUrl != null)
                    {
                        title.ImdbUrl = model.ImdbUrl;
                    }

                    if (model.ReleaseDate != null)
                    {
                        title.ReleaseDt = model.ReleaseDate;
                    }

                    title.DateModified = DateTime.Now;

                    return(title);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }