public IActionResult SHA256Encrypt([FromBody] HashViewModel viewModel) { SHA256Hash hash = new SHA256Hash(); string encrypted = ""; try { encrypted = hash.Encrypt(viewModel.Message); } catch (NullReferenceException) { } catch (Exception) { return(BadRequest(new { Result = false, Message = Text.InvalidCharacter })); } return(Json(encrypted)); }