public void AddMovieTestNullException() { CUMovieDto myNullEyxeotionMovie = new CUMovieDto(); myNullEyxeotionMovie = null; Task.WaitAll(Assert.ThrowsExceptionAsync <ArgumentNullException>(() => _MovieService.AddMovie(myNullEyxeotionMovie))); }
public IActionResult AddMovie([FromBody] MovieModel model) { if (_MovieService.AddMovie(model)) { return(Ok()); } else { return(BadRequest(new { message = "Movie could not be added." })); } }
public IActionResult AddMovie(MovieRequest request) { var success = _service.AddMovie(request); if (success) { return(Ok()); } else { return(BadRequest()); } }
public async Task <IActionResult> AddMovie(CUMovieDto newMovie) { try { var modelDb = await _moviesService.AddMovie(newMovie); return(Created($"movie/{modelDb.Id}", modelDb)); } catch (ArgumentException ex) { return(BadRequest(ex.Message)); } }
public IActionResult AddMovie(ViewMovies movies) { { var sPath = "C:/Users/m1043011/Pictures/Screenshots/Screenshot (47).png"; //Open FileStream to read file FileInfo fInfo = new FileInfo(sPath); FileStream fStream = new FileStream(sPath, FileMode.Open, FileAccess.Read); long numBytes = fInfo.Length; //Use BinaryReader to read file stream into byte array. BinaryReader br = new BinaryReader(fStream); movies.poster = br.ReadBytes((int)numBytes); int status = 0; foreach (var item in movies.Actors) { var movie = new Movies { actorid = int.Parse(item.Value), plot = movies.plot, poster = movies.poster, producerid = movies.producerid, yearofrelease = movies.yearofrelease }; status = moviesService.AddMovie(movie); } ViewBag.SuccessMsg = status == 1 ? "movie created successfully" : "unable to process at this time .. Sorry...."; } return(RedirectToAction("AddMovie")); }
public ((IEnumerable <Movies> movies, IEnumerable <Select> options), string error) AddMovie([FromQuery] string name, [FromQuery] int price, [FromQuery] string url, [FromQuery] string username) { return(_moviesService.AddMovie(name, price, url, username)); }
//IHttpActionResult googlear public IHttpActionResult AddMovie(Entities.Movie m) { _moviesSvc.AddMovie(m); return(Ok()); }