Ejemplo n.º 1
0
        public async Task <IActionResult> GetTypes([FromRoute] long id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            SpecificType specificType = new SpecificType();

            var types = await _context.types.Include(t => t.goods).FirstOrDefaultAsync(t => t.id == id);

            specificType.id        = types.id;
            specificType.name      = types.name;
            specificType.specGoods = new List <Goods>();
            foreach (var gt in types.goods)
            {
                var goods = await _context.goods.Include(g => g.images).FirstOrDefaultAsync(g => g.id == gt.goodsId);

                specificType.specGoods.Add(goods);
            }

            if (types == null)
            {
                return(NotFound());
            }

            return(Ok(specificType));
        }
Ejemplo n.º 2
0
 internal NodeType(BasicType basic, GenericType generic, SpecificType specific)
 {
     Basic    = basic;
     Generic  = generic;
     Specific = specific;
 }