public async Task <IActionResult> UserRegister([Required][FromBody] CustomerDetails userDetails) { CustomerValidator customerValidator = new CustomerValidator(); FluentValidation.Results.ValidationResult validationResult = customerValidator.Validate(userDetails); if (!validationResult.IsValid) { return(BadRequest(validationResult.ToString("; "))); } var result = await Task <int> .Run(() => _customerBusiness.UserRegisteration(userDetails)); if (result > 0) { return(Ok("User Added Successfully")); } else { return(BadRequest("User is not added")); } }
public async Task <IActionResult> UpdateCustomerDetails([Required][FromBody] CustomerDetails customerDetails) { //_msgObj.RegisterOnMessageHandlerAndReceiveMessages(); CustomerValidator customerValidator = new CustomerValidator(); FluentValidation.Results.ValidationResult validationResult = customerValidator.Validate(customerDetails); if (!validationResult.IsValid) { return(BadRequest(validationResult.ToString("; "))); } var result = await Task <int> .Run(() => _customerBusiness.UpdateCustomerDetails(customerDetails)); if (result > 0) { return(Ok("Customer data updated successfully")); } else { return(BadRequest("Customer data cannot be updated.Please try again later")); } }