public async Task <IActionResult> GetGender(int id)
        {
            var entity = await _service.GetAsync(id);

            if (entity is null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(entity));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets list of genders
        /// </summary>
        /// <param name="queryModel">The queryModel to use</param>
        /// <returns>A list of genders</returns>
        public async Task <IHttpActionResult> GetGenders([FromUri] PagingQueryBindingModel <SimpleLookupDTO> queryModel)
        {
            if (ModelState.IsValid)
            {
                var genders = await service.GetAsync(queryModel.ToQueryableOperator(DEFAULT_GENDER_DTO_SORTER));

                return(Ok(genders));
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var entity = await _service.GetAsync();

                return(Ok(_mapper.Map <ICollection <BL.Gender>, ICollection <Gender> >(entity)));
            }
            catch (Exception ex)
            {
                return(BadRequest($"{ex.Message}"));
            }
        }
Beispiel #4
0
        public async Task <ActionResult <DictionariesApiModel <int> > > Dictionaries()
        {
            var langId  = GetLanguageId();
            var start   = 0;
            var count   = 1000;
            var sorting = new List <EntitySortingEnum>()
            {
                EntitySortingEnum.ByCreateDesc
            };
            var modelResponseType = TypeModelResponseEnum.GetMinApiModel;

            DictionariesApiModel <int> result = new DictionariesApiModel <int>();

            var languages = await _languageService.GetAsync(start, count, sorting, modelResponseType, langId);

            var gender = await _genderService.GetAsync(start, count, sorting, modelResponseType, langId);

            result.Languages = languages.Models.ToList();
            result.Genders   = gender.Models.ToList();

            return(SuccessResult(result));
        }
Beispiel #5
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _genderService.GetAsync()));
 }