Пример #1
0
        public IActionResult GetAllMenu()
        {
            try
            {
                var stopwatch = StopwatchLogger.Start(_log);
                _log.Info("Called MenuController GetMenu");

                List <MenuItem> Objmenu = new List <MenuItem>();

                try
                {
                    Objmenu = _iMenuManager.GetMenuBytenant(TenantCode);
                }
                catch (Exception ex)
                {
                    _log.Error(ExceptionFormatter.SerializeToString(ex));
                    return(BadRequest("Incorrect Type."));
                }

                stopwatch.StopAndLog("GetMenu of MenuController");

                var settings = new JsonSerializerSettings();
                settings.NullValueHandling = NullValueHandling.Ignore;
                settings.ContractResolver  = new CamelCasePropertyNamesContractResolver();
                return(Json(Objmenu, settings));
            }
            catch (Exception ex)
            {
                _log.Error(ExceptionFormatter.SerializeToString(ex));
                return(StatusCode((int)HttpStatusCode.InternalServerError, ApiConstant.CustomErrorMessage));
            }
        }