public async Task <TagEntity> AddTagAsync(TagEntity tagEntity) { tagEntity.Url = tagEntity.Name.Unidecode(); await _newsContext .Tags .AddAsync(tagEntity); await _newsContext.SaveChangesAsync(); return(tagEntity); }
public async Task <CategoryEntity> AddCategoryAsync(CategoryEntity categoryEntity) { categoryEntity.Url = categoryEntity.Url.ToLower(); await _newsContext .Categories .AddAsync(categoryEntity); await _newsContext.SaveChangesAsync(); return(categoryEntity); }
public async Task <T> AddPostAsync <T>(T map) where T : PostEntity { map.ModifiedOn = DateTime.Now; map.CreatedOn = DateTime.Now; map.PublishedOn = DateTime.Now; // TODO! await _newsContext.Set <T>().AddAsync(map); await _newsContext.SaveChangesAsync(); return(map); }