public async Task <int> CreatePostCategoryAsync(CreatePostCategoryModel model) { #region Validation var userInfo = contextProvider.BusinessContext.PrincipalInfo; var validationData = new ValidationData(resultLocalizer); // validation logic here if (!validationData.IsValid) { throw validationData.BuildException(); } #endregion var entity = model.MapTo <PostCategoryEntity>(); PrepareCreate(entity); entity = dbContext.PostCategory.Add(entity).Entity; await dbContext.SaveChangesAsync(); return(entity.Id); }
public async Task <IActionResult> CreatePostCategory(CreatePostCategoryModel model) { var id = await _postCategoryService.CreatePostCategoryAsync(model); return(Success(id)); }