public async Task Put(CategoryDTO item) { using (var repo = new CategoryRepository()) { Category existing = await repo.GetById(item.Id); if (existing == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } item.Save(existing); await repo.Commit(); } }
public async Task <int> Post(CategoryDTO item) { using (var repo = new CategoryRepository()) { Category category = new Category(); item.Save(category); await repo.Create(category); await repo.Commit(); return(category.Id); } }