public ActionResult UpdateableauView(AHP.Web.ViewModel.TableauWorkbookViewModel tableauView) { GenericAjaxResponse <bool> response = new GenericAjaxResponse <bool>(); try { if (ModelState.IsValid) { Guid parsedViewId; if (!string.IsNullOrEmpty(tableauView.ViewId) && Guid.TryParse(tableauView.ViewId, out parsedViewId)) { AHP.Core.DTO.TableauViewInfo dto = new Core.DTO.TableauViewInfo(); dto.Description = string.IsNullOrEmpty(tableauView.Description)?string.Empty: tableauView.Description.Substring(0, Math.Min(400, tableauView.Description.Length)); dto.Disabled = string.IsNullOrEmpty(tableauView.Disabled) ? "N" : tableauView.Disabled; dto.IsDashboard = string.IsNullOrEmpty(tableauView.IsDashboard) ? "N" : tableauView.IsDashboard; dto.ViewId = tableauView.ViewId; dto.ViewName = tableauView.ViewName; dto.ViewUrl = tableauView.ViewUrl; response = _restClient.UpdateTableauView(dto); } else { response.Success = false; response.Errors.Add("View Id is required. Please refresh screen and try again."); } } else { foreach (var modelKey in ModelState.Keys) { response.Errors.AddRange(ModelState[modelKey].Errors.Select(err => err.ErrorMessage)); } response.Success = response.Errors.Count == 0; } } catch (Exception ex) { response.Success = response.Data = false; response.Errors.Add("Could not process your request. Please try again."); _logger.Error("Update tableau view ended up with an error", ex); } return(Json(response)); }