示例#1
0
        public async Task <List <ReadRelationDTO> > GetAllRelations()
        {
            var       location = HttpContext.Session.GetString("LocationId");
            EntityDTO dto      = new EntityDTO();

            dto.Id = Guid.Parse(location);

            try
            {
                var relations = await _relationService.GetAllRelations(dto);

                if (relations.Count > 0)
                {
                    return(relations);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public async Task <IActionResult> Index()
        {
            IEnumerable <ReadRelationDTO> relations = null;
            var       location = HttpContext.Session.GetString("LocationId");
            EntityDTO dto      = new EntityDTO
            {
                Id = Guid.Parse(location)
            };

            try
            {
                relations = await _relationService.GetAllRelations(dto);
            }
            catch (Exception e)
            {
                throw e;
            }

            if (relations != null)
            {
                return(View(relations));
            }
            else
            {
                return(View());
            }
        }