示例#1
0
        private List <SelectListItem> GetApplianceSelectList(string userToken, string displayLanguage)
        {
            // aktif cihaz kayıtları listelenir
            List <SelectListItem> resultList = new List <SelectListItem>();
            var apiResponseModel             = _applianceService.GetAll(userToken, displayLanguage);

            resultList = apiResponseModel.Data.OrderBy(r => r.Name).Select(r => new SelectListItem()
            {
                Value = r.Id.ToString(), Text = r.Name
            }).ToList();
            return(resultList);
        }
示例#2
0
        public IActionResult GetAll([FromHeader] string displayLanguage)
        {
            ApiResponseModel <List <Data.Entity.Appliance> > responseModel = new ApiResponseModel <List <Data.Entity.Appliance> >()
            {
                DisplayLanguage = displayLanguage
            };

            try
            {
                var appliance = _applianceService.GetAll();
                responseModel.Data                = appliance;
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
                return(Ok(responseModel));
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
                responseModel.Data = null;
                return(StatusCode(StatusCodes.Status500InternalServerError, responseModel));
            }
        }