public async Task <IActionResult> GetGenders() { var result = await _genderBusiness.GetAllGenders(); if (result.Any()) { return(Ok(result)); } return(NotFound()); }
public async Task <IActionResult> GetAll() { try { var result = await _genderBusiness.GetAllGenders(); if (result == null) { return(NotFound()); } return(Ok(result)); } catch (Exception e) { return(BadRequest(e.Message)); } }
private async Task SetDropDownList(string authorGenderName = null) { var genders = await _genderBusiness.GetAllGenders(); IList <SelectListItem> selectListItems = new List <SelectListItem>(); foreach (var genderDto in genders) { SelectListItem mySelectListItem = new SelectListItem { Text = genderDto.GenderType, Value = genderDto.Id.ToString(), Selected = authorGenderName == genderDto.GenderType }; selectListItems.Add(mySelectListItem); } ViewData["GenderList"] = selectListItems; }
public async Task <IActionResult> Index() { var result = await _genderBusiness.GetAllGenders(); return(View(result)); }