Beispiel #1
0
        //private List<string> GoodEnoughTags(List<ImageAnalysis> analysises)
        //{
        //    var GoodEnoughTags = new List<string>();
        //    foreach (var item in analysises)
        //    {
        //        GoodEnoughTags.AddRange(item.Tags.Where(x => x.Confidence > 0.1).Select(x => x.Name));
        //    }

        //    return GoodEnoughTags;
        //}

        // GET: Things/Edit/5
        public async Task <IActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var thing = await _context.Thing.FindAsync(id);

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

            //ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id");
            var viewModel = new CreateThingsComponentViewModel();

            viewModel.GroupSelections = _userManager.GetUserAsync(User).Result.GroupUsers.Select(groupUser =>
                                                                                                 new GroupSelection()
            {
                Id       = groupUser.GroupId,
                Name     = groupUser.Group.Name,
                Selected = true
            }
                                                                                                 ).ToArray();

            viewModel.Thing = thing;

            //ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", thing.UserId);
            return(View(viewModel));
        }
Beispiel #2
0
        // GET: Things/Create
        public IActionResult Create()
        {
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id");
            var viewModel = new CreateThingsComponentViewModel();

            viewModel.GroupSelections = _userManager.GetUserAsync(User).Result.GroupUsers.Select(groupUser =>
                                                                                                 new GroupSelection()
            {
                Id       = groupUser.GroupId,
                Name     = groupUser.Group.Name,
                Selected = true
            }
                                                                                                 ).ToArray();

            return(View(viewModel));
        }