Exemplo n.º 1
0
 public void CreateTheme(ThemeCreateModel themeCreateModel, int userId)
 {
     using (UnitOfWork unitOfWork = _unitOfWorkFactory.Create())
     {
         Theme theme = Mapper.Map <Theme>(themeCreateModel);
         theme.AuthorId = userId;
         unitOfWork.Themes.Create(theme);
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateTheme(ThemeCreateModel theme)
        {
            try
            {
                User user = await _userManager.GetUserAsync(User);

                _themeService.CreateTheme(theme, user.Id);
                List <ThemeModel> themes = _themeService.GetAllThemes();
                return(PartialView("_AllThemes", themes));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e));
            }
        }