public async Task <Dto.WebSite> Delete(long id) { var model = await this.unitOfWork.WebSites.GetById(id); Dbo.WebSite deletedWebsite = this.unitOfWork.WebSites.Delete(model); await this.unitOfWork.SaveChanges(); return(deletedWebsite.Map()); }
public async Task <Dto.WebSite> Create(Dto.WebSite website) { Validated.NotNull(website, nameof(website)); Dbo.Category category = await this.categoryService.GetByName(website.Category.Name); if (category == null) { category = await this.categoryService.Create(website.Category.Map()); } website.Category.Id = category.Id; Dbo.WebSite addedWebsite = this.unitOfWork.WebSites.Add(website.Map()); await this.unitOfWork.SaveChanges(); return(addedWebsite.Map()); }