public async Task <IResult> Delete(int id) { var result = new Result { Operation = Operation.Delete, Status = Status.Success }; try { var attr = await _productAttributeRepository.GetAttribute(id); if (attr == null) { result.Status = Status.Success; result.StatusCode = HttpStatusCode.BadRequest; result.Message = "Attribute does not exist."; return(result); } var deleteAttr = await _productAttributeRepository.DeleteAttribute(id); return(deleteAttr); } catch (Exception e) { result.Status = Status.Error; result.Message = e.Message; result.StatusCode = HttpStatusCode.InternalServerError; return(result); } }