Example #1
0
        public ActionResult <IEnumerable <Element> > Get(bool includeHeavierThanOxygen = false)
        {
            var userName = User.Identity.Name;

            var elements       = _elementDataService.GetByName("", includeHeavierThanOxygen);
            var elementsByUser = _elementDataService.GetByUserAndName(userName, "");

            try
            {
                return(Ok(_mapper.Map <IEnumerable <Element>, IEnumerable <ElementViewModel> >(elementsByUser)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to get elements: {ex}");
                return(BadRequest("Failed to get elements"));
            }
        }
Example #2
0
 private IEnumerable <Element> GetElements(bool heavierThanOxygen = false)
 {
     return(_elementDataService.GetByName("", heavierThanOxygen));
 }