public async Task <RemoveProductOptionOutputDto> RemoveProductOption(RemoveProductOptionInputDto aParams) { RemoveProductOptionOutputDto output = new RemoveProductOptionOutputDto(); try { await UnitOfWork.ProductOptionRepository.RemoveProductOptionsAsync(aParams.Id); await UnitOfWork.SaveChanges(); } catch (Exception e) { output.ResultErrors.Messages.Add(e.Message); } return(output); }
public async Task <ActionResult <RemoveProductOptionItemOutputModel> > Delete(Guid aProductId, Guid aOptionId) { try { RemoveProductOptionOutputDto result = await _aProductOptionService.RemoveProductOption(new RemoveProductOptionInputDto() { Id = aOptionId }); if (result.ResultSuccess) { return(_aMapper.Map <RemoveProductOptionItemOutputModel>(result)); } return(StatusCode(StatusCodes.Status500InternalServerError, result.ResultErrors.Messages.First())); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, "Server Error")); } }