public ViewResult Create(int ResourceId) { var res = repositoryWrapper.Resource.FindByCondition(r => r.ResourceId == ResourceId).First(); var newDeckDto = new CreateDeckDto { ResourceId = ResourceId, ResourceTitle = res.Title, SubjectId = res.SubjectId }; return(View(newDeckDto)); }
public ActionResult Create(CreateDeckDto createDeckDto) { try { var newDeck = new Deck() { ResourceId = createDeckDto.ResourceId, Title = createDeckDto.Title, IsShared = createDeckDto.IsShared }; deckService.AddDeck(newDeck); return(RedirectToAction(nameof(Index), new { ParentId = createDeckDto.ResourceId })); } catch (Exception ex) { return(View()); } }