public async Task <ActionResult> Post(MovieTheaterCreationDTO movieCreationDTO) { var movieTheater = _mapper.Map <MovieTheater>(movieCreationDTO); _dbContext.Add(movieTheater); await _dbContext.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> Post([FromBody] MovieTheaterCreationDTO movieTheaterCreationDTO) { var entity = this.mapper.Map <MovieTheater>(movieTheaterCreationDTO); this.dbContext.Add(entity); await this.dbContext.SaveChangesAsync(); return(this.NoContent()); }
public async Task <ActionResult> Put(int id, MovieTheaterCreationDTO movieTheaterCreationDTO) { var movieTheather = await context.MovieTheaters.FirstOrDefaultAsync(x => x.Id == id); if (movieTheather == null) { return(NotFound()); } movieTheather = mapper.Map(movieTheaterCreationDTO, movieTheather); await context.SaveChangesAsync(); return(NoContent()); }
public async Task <MovieTheater> UpdateMovieTheater(int id, MovieTheaterCreationDTO movieTheaterCreationDTO) { var movieTheater = await GetById(id); if (movieTheater == null) { return(null); } movieTheater = _mapper.Map(movieTheaterCreationDTO, movieTheater); await applicationDb.SaveChangesAsync(); return(movieTheater); }
public async Task <ActionResult> Put(int id, [FromBody] MovieTheaterCreationDTO movieTheaterCreationDTO) { var entity = await this.dbContext.MovieTheaters.FirstOrDefaultAsync(x => x.Id == id); if (entity == null) { return(this.NotFound()); } entity = this.mapper.Map(movieTheaterCreationDTO, entity); await this.dbContext.SaveChangesAsync(); return(this.NoContent()); }
public async Task <ActionResult> PutMovieTheater([FromRoute] int id, MovieTheaterCreationDTO movieTheaterCreationDTO) { await repository.UpdateMovieTheater(id, movieTheaterCreationDTO); return(NoContent()); }
public async Task <ActionResult> PostMovieTheater(MovieTheaterCreationDTO movieTheaterCreationDTO) { await repository.AddMovieTheater(movieTheaterCreationDTO); return(NoContent()); }
public async Task <ActionResult> Put(int id, [FromBody] MovieTheaterCreationDTO movieTheaterCreationDTO) { return(await Put <MovieTheaterCreationDTO, MovieTheater>(id, movieTheaterCreationDTO)); }
public async Task <ActionResult> Post([FromBody] MovieTheaterCreationDTO movieTheaterCreationDTO) { return(await Post <MovieTheaterCreationDTO, MovieTheater, MovieTheaterDTO>(movieTheaterCreationDTO, "getMovieTheater")); }
public async Task <MovieTheater> AddMovieTheater(MovieTheaterCreationDTO movieTheaterCreationDTO) { var movieTheater = _mapper.Map <MovieTheater>(movieTheaterCreationDTO); return(await Add(movieTheater)); }