示例#1
0
        public async Task <ActionResult <Label> > GetLabel(int id)
        {
            //var label = await _context.Labels.FindAsync(id);
            var label = await _repository.GetById(id);

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

            return(label);
        }
        // GET: Labels/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            //var label = await _context.Labels.FirstOrDefaultAsync(m => m.LabelId == id); // Original scaffold call using context directly
            var label = await _repository.GetById((int)id);

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

            return(View(label));
        }