public IActionResult CreateLibrary(LibraryForManipulation libraryDto) { var libraryEntity = _mapper.Map <Entities.Library>(libraryDto); _repo.CreateLibrary(libraryEntity); _repo.Save(); var libraryForReturn = _mapper.Map <LibraryForReturnDto>(libraryEntity); return(CreatedAtRoute("GetLibrary", new { id = libraryForReturn.Id }, libraryForReturn)); }
public async Task <IActionResult> Create([Bind("LibraryID,PlayerID,GameID")] Library library) { if (ModelState.IsValid) { await _libraryRepository.CreateLibrary(library); return(RedirectToAction(nameof(Index))); } //ViewData["GameID"] = new SelectList(_context.Game, "GameID", "GameID", library.GameID); //ViewData["PlayerID"] = new SelectList(_context.Player, "PlayerID", "PlayerID", library.PlayerID); return(View(library)); }