public async Task <IResult> Update(ProductAttributeViewModel productAttribute) { var result = new Result { Operation = Operation.Update, Status = Status.Success }; try { var attributeObj = await _productAttributeRepository.GetAttribute(productAttribute.AttributeId); if (attributeObj == null) { result.Status = Status.Fail; result.StatusCode = HttpStatusCode.BadRequest; result.Message = "isEmpty"; return(result); } var attributeNameCheck = await _productAttributeRepository.CheckExistingAttribute(productAttribute.AttributeName); if (!attributeNameCheck) { result.Status = Status.Fail; result.StatusCode = HttpStatusCode.BadRequest; result.Message = "isPresent"; return(result); } ProductAttributeModel attrModel = new ProductAttributeModel(); attrModel.MapFromModel(productAttribute); attrModel.AttributeName = productAttribute.AttributeName; attrModel.ModifiedDate = DateTime.Now; attrModel.ModifiedBy = _specificClaim.GetSpecificClaim("Id"); var updateAttr = await _productAttributeRepository.UpdateAttribute(attrModel); return(updateAttr); } catch (Exception e) { result.Status = Status.Error; result.Message = e.Message; result.StatusCode = HttpStatusCode.InternalServerError; return(result); } }