private List <SelectListItem> GetSexSelectList(string userToken, string displayLanguage) { // aktif cinsiyet kayıtları listelenir List <SelectListItem> resultList = new List <SelectListItem>(); var apiResponseModel = _sexService.GetAll(userToken, displayLanguage); resultList = apiResponseModel.Data.OrderBy(r => displayLanguage == "tr" ? r.NameTR : r.NameEN).Select(r => new SelectListItem() { Value = r.Id.ToString(), Text = displayLanguage == "tr" ? r.NameTR : r.NameEN }).ToList(); return(resultList); }
private List <SelectListItem> GetSexSelectList() { // sex select list List <SelectListItem> resultList = new List <SelectListItem>(); try { resultList = _sexService.GetAll().OrderBy(r => r.Name).Select(r => new SelectListItem() { Value = r.Id.ToString(), Text = r.Name }).ToList(); } catch { resultList = new List <SelectListItem>(); } return(resultList); }
//[TokenAuthorizeFilter] // sadece oturum acilma kontrolu yapilir public IActionResult GetSex([FromHeader] string displayLanguage) { ApiResponseModel <List <Data.Entity.Sex> > responseModel = new ApiResponseModel <List <Data.Entity.Sex> >() { DisplayLanguage = displayLanguage }; try { var sex = _sexService.GetAll(); responseModel.Data = sex; 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)); } }