public async Task UpdateCategoryAsync(int id, CreateUpdateCategoryInput input) { var category = await _repository.FindAsync(id); if (category == null) { ExceptionBuilder.Build(HttpStatusCode.NotFound, new HttpException($"Id {id} not match category")); } await _categoryManager.SetName(input.Name, category); await _repository.UpdateAsync(id, category); }
public async Task <StandardOutput <bool> > UpdateCategory(CreateUpdateCategoryInput input) { var responseMessage = await _categoryProvider.UpdateCategory(input); if (responseMessage.StateCode != Define.StateCode.OK) { return new StandardOutput <bool> { Entity = false, Message = $"Update category failed. Check if category Name: {input.Name} is already existed or id {input.Id} Not Found." } } ; return(new StandardOutput <bool> { Entity = true, Message = "Update category succeed." }); }
public async Task <ResponseMessage <bool> > UpdateCategory(CreateUpdateCategoryInput input) { return(await SendEmptyResponseBodyRequest(Category, _http.PutAsJsonAsync, input)); }
public async Task CreateCategoryAsync(CreateUpdateCategoryInput input) { var category = await _categoryManager.CreateCategory(input.Name); await _repository.CreateAsync(category); }
public async Task Update(CreateUpdateCategoryInput input) { await _categoryService.UpdateCategoryAsync(input.Id, input); }