public async Task <ServiceResponse <GetProductGroupDto> > EditProductGroup(EditProductGroupDto editProductGroup) { var productgroup = await _dbContext.ProductGroups.FirstOrDefaultAsync(x => x.Id == editProductGroup.Id); if (productgroup == null) { return(ResponseResult.Failure <GetProductGroupDto>("productgroup not found.")); } productgroup.Name = editProductGroup.Name; productgroup.IsActive = editProductGroup.IsActive; productgroup.UserId = Guid.Parse(GetUserId()); productgroup.CreatedDate = Now(); _dbContext.ProductGroups.Update(productgroup); await _dbContext.SaveChangesAsync(); var dto = _mapper.Map <GetProductGroupDto>(productgroup); return(ResponseResult.Success(dto)); }
public async Task <IActionResult> EditProductGroup(EditProductGroupDto editProductGroup) { return(Ok(await _productservice.EditProductGroup(editProductGroup))); }