public async Task <IActionResult> Create([FromBody] MembershipCategoryDto categoryDto) { if (categoryDto == null) { return(BadRequest("No data found")); } await _category.CreateAsync(categoryDto); return(Ok(categoryDto)); }
public async Task CreateAsync(MembershipCategoryDto categoryDto) { var category = new Category(); category.Name = categoryDto.Name; category.RoleId = 1; category.BranchId = 0; category.CreatedDate = DateTime.Now; category.UpdatedDate = DateTime.Now; category.Active = true; await _categoryRepository.AddAsync(category); }