public static MovieModel Create(Movie movie) { return new MovieModel() { Id = movie.Id, Name = movie.Name, URL = movie.URL, Rating = movie.Rating, Description = movie.Description }; }
public bool AddMovie(Movie movie) { try { return movieReporsitory.AddMovie(movie); } catch (Exception) { //LogException here //ExceptionHandler.HandleException(ex,ExceptionHandler.Policy.Business); } return false; }
public bool UpdateMovie(Movie movie) { try { int index = movies.FindIndex(p => p.Id == movie.Id); if (index == -1) { return false; } movies.RemoveAt(index); movies.Add(movie); } catch (Exception) { // Log your exception here // throw exception based on exception policy return false; } return true; }
public bool AddMovie(Movie movie) { // TODO // Add validation for Unique contrainst etc. try { movie.Id = GetId(); movies.Add(movie); } catch (Exception) { // Log your exception here // throw exception based on exception policy //ExceptionHandler.HandlerException(ex, ExceptionHandler.Policy.DataAccess); return false; } return true; }
private bool Validate(Movie movie) { // Add Model Validation Here or call Biz Validation Method if (string.IsNullOrEmpty(movie.Name)) return false; return true; }