コード例 #1
0
ファイル: ProductsPage.cs プロジェクト: nchicas/Combinado
 public ProductsPage( Category category, Subcategory subcategory )
 {
     this.category = category;
     this.subcategory = subcategory;
     System.Diagnostics.Debug.WriteLine ( category.ToString() + " " + subcategory.ToString() );
     InitializeComponents ().ConfigureAwait(false);
 }
コード例 #2
0
ファイル: SubcategoryManager.cs プロジェクト: rishabh2226/GUM
        public void Update(Subcategory subcategory)
        {
            var subcate = (from c in dbContext.SubCategories
                           where c.SubCategoryID == subcategory.SubcategoryID
                           select c).FirstOrDefault();

            if (subcate != null)
            {
                subcate.SubCategoryName = subcategory.SubcategoryName;
                subcate.CategoryID      = subcategory.CategoryID;
                subcate.Description     = subcategory.Description;
                if (subcategory.Image != null)
                {
                    subcate.Picture = subcategory.Image;
                }
                //subcate.Picture = subcategory.Image;
                dbContext.SaveChanges();
            }
        }
コード例 #3
0
        public ActionResult Createsubcategory(SubcategoryModel model)
        {
            if (ModelState.IsValid)
            {
                using (_dbContext = new karrykartEntities())
                {
                    var Subcategory = new Subcategory();
                    Subcategory.CategoryID = model.CategoryID;
                    Subcategory.Name       = model.Name;

                    _dbContext.Subcategories.Add(Subcategory);
                    _dbContext.SaveChanges();
                    _logger.WriteLog(CommonHelper.MessageType.Success, "New sub category added successfully with id=" + Subcategory.SCategoryID, "CreateSubcategory", "CategoryController", User.Identity.Name);
                    Success("Subcategory added successfully");
                    return(RedirectToAction("Subcategory", "Category", new { id = model.CategoryID }));
                }
            }
            return(View(model));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CategoryId")] Subcategory subcategory)
        {
            if (id != subcategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var subcategories = _context.Subcategories.Where(s => s.Name == subcategory.Name).FirstOrDefault();

                    if (subcategories != null)
                    {
                        ModelState.AddModelError(string.Empty, "This subcategory already exists");
                        return(RedirectToAction("Edit", "Subcategories", new { id = subcategory.Id }));
                    }
                    else
                    {
                        _context.Update(subcategory);
                        await _context.SaveChangesAsync();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubcategoryExists(subcategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Subcategories", new { Id = subcategory.CategoryId, name = _context.Categories.Where(c => c.Id == subcategory.CategoryId).FirstOrDefault().Name }));
            }
            //ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", subcategory.CategoryId);
            //return View(subcategory);
            return(RedirectToAction("Index", "Subcategories", new { Id = subcategory.CategoryId, name = _context.Categories.Where(c => c.Id == subcategory.CategoryId).FirstOrDefault().Name }));
        }
コード例 #5
0
        public async Task <string> RestoreAsync(int supplementId)
        {
            Supplement supplement = await this.database
                                    .Supplements
                                    .Include(s => s.Manufacturer)
                                    .Include(s => s.Subcategory)
                                    .ThenInclude(sub => sub.Category)
                                    .Include(s => s.Reviews)
                                    .Include(s => s.Comments)
                                    .Where(s => s.Id == supplementId)
                                    .FirstOrDefaultAsync();

            Manufacturer manufacturer = supplement.Manufacturer;
            Subcategory  subcategory  = supplement.Subcategory;
            Category     category     = supplement.Subcategory.Category;

            if (manufacturer.IsDeleted)
            {
                return(string.Format(EntityNotExists, ManufacturerEntity));
            }

            if (category.IsDeleted || subcategory.IsDeleted)
            {
                return(string.Format(EntityNotExists, $"{CategoryEntity}/{SubcategoryEntity}"));
            }

            foreach (Review review in supplement.Reviews)
            {
                review.IsDeleted = false;
            }

            foreach (Comment comment in supplement.Comments)
            {
                comment.IsDeleted = false;
            }

            supplement.IsDeleted = false;

            await this.database.SaveChangesAsync();

            return(string.Empty);
        }
コード例 #6
0
        private async ValueTask <(Subcategory subcategory, string error)> CreateSubcategory(SubcategoryDTO entityDTO,
                                                                                            ICollection <Photo> defaultPhotoList = null,
                                                                                            List <Photo> scheduleAddedPhotoList  = null,
                                                                                            List <Photo> scheduleDeletePhotoList = null)
        {
            var subcategory = new Subcategory()
            {
                CategoryId    = entityDTO.NewCategoryId,
                SubcategoryId = entityDTO.Alias.TransformToId(),

                Alias     = entityDTO.Alias,
                IsVisible = entityDTO.IsVisible ?? true,

                Description = entityDTO.Description,

                SeoTitle       = entityDTO.SeoTitle,
                SeoDescription = entityDTO.SeoDescription,
                SeoKeywords    = entityDTO.SeoKeywords,

                Products = new List <Product>(),
                Photos   = new List <Photo>()
            };

            //Добавляем и проверяем можем ли мы добавить данную категорию
            var(isSuccess, error) = await _repository.AddSubcategory(subcategory);

            if (!isSuccess)
            {
                return(null, error);
            }

            _photoEntityUpdater.MovePhotosToEntity(subcategory, defaultPhotoList);

            await _photoEntityUpdater.LoadPhotosToEntity(subcategory,
                                                         entityDTO,
                                                         scheduleAddedPhotoList,
                                                         scheduleDeletePhotoList);

            await _context.SaveChangesAsync();

            return(subcategory, null);
        }
コード例 #7
0
        public bool Update(Subcategory t)
        {
            using (var ctx = new DatabaseContext())
            {
                Subcategory currenSubcategory = ctx.Subcategories.SingleOrDefault(x => x.Id == t.Id);

                if (currenSubcategory == null)
                {
                    return(false);
                }

                currenSubcategory.Name = t.Name;

                ctx.Entry(currenSubcategory).State = EntityState.Modified;

                ctx.SaveChanges();

                return(true);
            }
        }
コード例 #8
0
        public bool Delete(int id)
        {
            using (var ctx = new DatabaseContext())
            {
                Subcategory subSubcategory = ctx.Subcategories.AsNoTracking().SingleOrDefault(x => x.Id == id);

                if (subSubcategory == null)
                {
                    return(false);
                }

                //Subcategory.IsActive = false;

                ctx.Entry(subSubcategory).State = EntityState.Modified;

                ctx.SaveChanges();

                return(true);
            }
        }
コード例 #9
0
        public IActionResult CreateSubcategory([FromBody] SubcategoryForCreationDto subcategory)
        {
            if (!ModelState.IsValid || subcategory == null)
            {
                return(BadRequest(ModelState));
            }

            var subcategoryToSave = new Subcategory();

            AutoMapper.Mapper.Map(subcategory, subcategoryToSave);

            _vilabRepository.AddSubcategory(subcategoryToSave);

            if (!_vilabRepository.Save())
            {
                return(BadRequest($"failed to create subcategory {subcategory.Name} "));
            }

            return(Ok());
        }
コード例 #10
0
        // POST: api/Subcategory
        public HttpResponseMessage Post(Subcategory subcategory)
        {
            var fileName = Helpers.ImageHelper.SaveImage(subcategory.Image);

            if (fileName != null)
            {
                subcategory.Image = fileName;
                mgr.Add(subcategory);
                var subcategories = mgr.GetAll();
                subcategories.ForEach(x =>
                {
                    x.Image = "/Content/images/" + x.Image;
                });
                return(this.Request.CreateResponse(HttpStatusCode.OK, subcategories));
            }
            else
            {
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }
コード例 #11
0
        public Task <Pageable <Subcategory> > GetAll(int page, int size)
        {
            if (page == 2)
            {
                return(Task.Run(() => new Pageable <Subcategory>(new List <Subcategory>(), 0, page, size)));
            }
            var subcategories = new List <Subcategory>();

            for (int i = 0; i < size; i++)
            {
                var subcategory = new Subcategory()
                {
                    Name        = $"Teste {i}",
                    Description = $"Descrição do Teste {i}",
                    Code        = i
                };
                subcategories.Add(subcategory);
            }
            return(Task.Run(() => new Pageable <Subcategory>(subcategories, subcategories.Count, page, size)));
        }
コード例 #12
0
        // GET: Subcategories/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (!DbLayer.CheckIfLocaleExists(id))
            {
                return(HttpNotFound());
            }

            Subcategory sub = DbLayer.getSubcategory(id);

            if (sub == null)
            {
                return(HttpNotFound());
            }
            return(View());
        }
コード例 #13
0
        public async Task <IHttpActionResult> PostSubcategory(SubcategoryDTO subcategoryDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var subcategory = new Subcategory()
            {
                SubcategoryId   = Guid.NewGuid(),
                SubcategoryName = subcategoryDTO.SubcategoryName,
                ImageUrl        = subcategoryDTO.ImageUrl,
                CategoryId      = subcategoryDTO.CategoryId
            };

            db.Subcategories.Add(subcategory);
            await db.SaveChangesAsync();

            return(Ok(subcategoryDTO));
        }
コード例 #14
0
        public int CreatePost(string title, string adBody, string amount, int userId, int subcatagoryId, int cityId)
        {
            TexasListContext db = new TexasListContext();

            Subcategory catHolder = db.Subcategories.Where(c => c.SubcategoryId == subcatagoryId).First();

            Post newPost = db.Posts.Create();

            newPost.Title      = title;
            newPost.AdBody     = adBody;
            newPost.Amount     = amount;
            newPost.UserId     = userId;
            newPost.CityId     = cityId;
            newPost.CategoryId = catHolder.CategoryId;

            db.Posts.Add(newPost);
            db.SaveChanges();

            return(newPost.PostId);
        }
コード例 #15
0
        public Post CreateRegularPost()
        {
            Area        a      = CreateArea();
            Locale      lo     = a.Locales.First();
            Category    cat    = CreateCategory();
            Subcategory subcat = cat.Subcategories.First();

            return(new Post()
            {
                Date = DateTime.Now,
                Expiration = DateTime.Now.AddDays(5),
                Title = "Bubble Tea",
                Body = "Bubble Tea in longhua Jiufang",
                Viewable = true,
                PostArea = a,
                PostLocale = lo,
                PostCategory = cat,
                PostSubcategory = subcat
            });
        }
コード例 #16
0
        public ActionResult Create(Subcategory subcategory)
        {
            if (!User.IsInRole("Admin"))
            {
                return(HttpNotFound());
            }
            Category cc = db.Categories.Find(Convert.ToInt32(Request["chooseCategory"]));

            subcategory.RootCategory = cc;
            subcategory.Products     = new List <Product>();
            if (ModelState.IsValid)
            {
                cc.Subcategories.Add(subcategory);
                db.Subcategories.Add(subcategory);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View());
        }
コード例 #17
0
ファイル: StrikeApi.cs プロジェクト: modulexcite/Strike.NET
        /// <summary>
        ///     Performs a torrent search.
        /// </summary>
        /// <param name="phrase">Torrent search query.</param>
        /// <param name="category">Torrent category.</param>
        /// <param name="subCategory">Torrent subcategory.</param>
        /// <returns>Returns an array of search results.</returns>
        public TorrentSearchResult[] Search(string phrase, Category category = null, Subcategory subCategory = null)
        {
            if (phrase == null)
            {
                throw new ArgumentNullException("phrase");
            }

            if (phrase.Trim().Length < MinSearchQueryLength)
            {
                throw new StrikeException("Query must be at least 4 characters long without whitespace");
            }

            var results = new List <TorrentSearchResult>();

            var request = new RestRequest("torrents/search/", Method.GET);

            request.AddParameter("phrase", phrase);

            if (category != null)
            {
                request.AddParameter("category", category.Name);
            }
            if (subCategory != null)
            {
                request.AddParameter("subcategory", subCategory.Name);
            }

            var response = Execute <TorrentSearchResponse>(request);

            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                return(results.ToArray());
            }

            if (response.Data != null)
            {
                results.AddRange(response.Data.Torrents);
            }

            return(results.ToArray());
        }
コード例 #18
0
        public async Task <IActionResult> AddSubcategory(int categoryId, string subcategoryName)
        {
            if (!await _db.Categories.AnyAsync(c => c.Id == categoryId))
            {
                return(Json(false));
            }
            if (await _db.Subcategories.AnyAsync(c => c.Name.ToLower() == subcategoryName.ToLower()))
            {
                return(Json(false));
            }

            Subcategory subcategory = new Subcategory()
            {
                Name = subcategoryName, CategoryId = categoryId
            };
            await _db.Subcategories.AddAsync(subcategory);

            await _db.SaveChangesAsync();

            return(Json(true));
        }
コード例 #19
0
        public IHttpActionResult PutSubcategory(Subcategory subcategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid Data.."));
            }

            var subcategoryInDb = db.Subcategories.Single(s => s.SubcategoryId == subcategory.SubcategoryId);

            subcategoryInDb.Name         = subcategory.Name;
            subcategoryInDb.Pic          = subcategory.Pic;
            subcategoryInDb.Description  = subcategory.Description;
            subcategoryInDb.ModifiedBy   = User.Identity.Name;
            subcategoryInDb.ModifiedDate = DateTime.Now;
            subcategoryInDb.ParentId     = subcategory.ParentId;
            subcategoryInDb.CategoryId   = subcategory.CategoryId;

            db.SaveChanges();

            return(Ok("Successfully updated"));
        }
コード例 #20
0
        public ActionResult Edit(int id)
        {
            if (!User.IsInRole("Admin"))
            {
                return(HttpNotFound());
            }
            Subcategory subcategory = db.Subcategories.Find(id);

            if (subcategory == null)
            {
                return(HttpNotFound());
            }
            if (subcategory.Name.Equals("Разное"))
            {
                System.Windows.Forms.MessageBox.Show("Эту подкатегорию нельзя редактировать");
                return(RedirectToAction("Index"));
            }

            Session["categoryListForCreate"] = db.Categories.ToList();
            return(View(subcategory));
        }
コード例 #21
0
        public IActionResult Add(SubcategoryFormModel model, IFormFile upload)
        {
            if (ModelState.IsValid)
            {
                var subcategory = new Subcategory()
                {
                    Category       = _categoryRepository.GetCategory(model.CategoryId),
                    CategoryId     = model.CategoryId,
                    CommonName     = model.CommonName,
                    Description    = model.Description,
                    ScientificName = model.ScientificName,
                    Slug           = model.Slug,
                };
                subcategory = SaveImage(upload, subcategory);

                _subcategoryRepository.Save(subcategory);

                return(RedirectToAction("Index", model.CategoryId));
            }
            return(View(model));
        }
コード例 #22
0
        public HttpStatusCode DeleteSubcategory(int subcategoryId)
        {
            Subcategory subcategory = _ctx.Subcategories.FirstOrDefault(f => f.Id == subcategoryId);

            if (subcategory == null)
            {
                return(HttpStatusCode.NotFound);
            }

            try
            {
                _ctx.Subcategories.Remove(subcategory);
                _ctx.SaveChanges();

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return(HttpStatusCode.InternalServerError);
            }
        }
コード例 #23
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (!User.IsInRole("Admin"))
            {
                return(HttpNotFound());
            }
            Subcategory subcategory = db.Subcategories.Find(id);

            Subcategory reserv = db.Subcategories.First(e => e.Name == "Разное" && e.RootCategory.CategoryId == subcategory.RootCategory.CategoryId);//  (e => e.Name == "Разное");

            reserv.Products.AddRange(subcategory.Products);

            foreach (var product in subcategory.Products)
            {
                product.Subcategories.Remove(subcategory);
                product.Subcategories.Add(reserv);
            }
            db.Subcategories.Remove(subcategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #24
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Subcategory = await _context.Subcategory
                          .Include(s => s.Category)
                          .Include(s => s.Language).SingleOrDefaultAsync(m => m.Id == id);

            if (Subcategory == null)
            {
                return(NotFound());
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Id");
            ViewData["Languageid"] = new SelectList(_context.Language, "Id", "Id");
            ViewData["Language"]   = new SelectList(_context.Language, "Id", "Language1");
            ViewData["Category"]   = new SelectList(_context.Category, "Id", "Category1");
            return(Page());
        }
コード例 #25
0
        public async Task <IActionResult> Edit(int id, Subcategory subcategory)
        {
            if (id != subcategory.SubcategoryID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                    var values = new Subcategory
                    {
                        SubcategoryID   = subcategory.SubcategoryID,
                        CategoryID      = subcategory.CategoryID,
                        SubcategoryName = subcategory.SubcategoryName,
                        UserID          = userId
                    };
                    _context.Update(values);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubcategoryExists(subcategory.SubcategoryID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var userId2 = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            ViewData["CategoryID"] = new SelectList(_context.Categories.Where(x => x.UserID == userId2), "CategoryID", "CategoryName", subcategory.CategoryID);
            return(View(subcategory));
        }
コード例 #26
0
        private void Print_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDialog = new PrintDialog();

            if (printDialog.ShowDialog() == true)
            {
                // Скрыть Grid
                grid.Visibility = Visibility.Hidden;
                MContext    mc  = new MContext();
                Subcategory sub = mc.Subcategories.First(x => x.ID == s.ID_Subcategory);
                PriceFormat pf  = mc.PriceFormat.First(x => x.ID == sub.ID_PriceFormat);
                // Увеличить размер в 5 раз
                MyCanvas.LayoutTransform = new ScaleTransform(pf.TransX, pf.TransY);
                // Определить поля
                int pageMargin = pf.Margin;

                // Получить размер страницы
                System.Windows.Size pageSize = new System.Windows.Size(pf.X, pf.Y);
                // Инициировать установку размера элемента
                MyCanvas.Measure(pageSize);
                MyCanvas.Arrange(new Rect(pageMargin, pageMargin, pageSize.Width, pageSize.Height));

                // Напечатать элемент
                printDialog.PrintVisual(MyCanvas, "Распечатываем элемент Canvas");

                // Удалить трансформацию и снова сделать элемент видимым
                MyCanvas.LayoutTransform = null;
                grid.Visibility          = Visibility.Visible;
                if (s.TotalPrice != 0)
                {
                    SKU stmp = mc.SKUs.First(x => x.ID == s.ID);
                    stmp.Price       = s.TotalPrice;
                    stmp.TotalPrice  = 0;
                    stmp.Promo       = s.TotalPromo;
                    stmp.ChangePrice = false;
                    mc.SaveChanges();
                }
            }
            this.Close();
        }
コード例 #27
0
        public object GetSubcategoryById(int id)
        {
            using (SqlConnection connection = Database.Connection)
            {
                try
                {
                    Subcategory subcat = new Subcategory();
                    subcat.Category = new Category();
                    SqlCommand sqlCom = connection.CreateCommand();

                    sqlCom.CommandText = @"SELECT * FROM Subcategory INNER JOIN Category ON Subcategory.categoryid = Category.categoryid WHERE Subcategory.subcategoryid=@id";
                    sqlCom.Parameters.Add("@id", SqlDbType.Int);

                    sqlCom.Parameters["@id"].Value = id;

                    connection.Open();

                    using (SqlDataReader reader = sqlCom.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            subcat.SubcategoryId       = id;
                            subcat.Name                = (string)reader["subcategoryname"];
                            subcat.Category.CategoryId = (int)reader["categoryid"];
                            subcat.Category.Name       = (string)reader["categoryname"];
                        }
                    }
                    return(subcat);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return("error");
                }
                finally
                {
                    connection.Close();
                }
            }
        }
コード例 #28
0
        public async Task Details_UserListing_ListingDetailsView()
        {
            // Arrange
            var listingsController = this.CreateListingsController(true);
            var category           = new Category()
            {
                Name = "Test", Id = 5
            };
            var subcategory = new Subcategory()
            {
                Name = "TESTAS", Id = 5, Categoryid = 5
            };

            context.Category.Add(category);
            context.Subcategory.Add(subcategory);
            await context.SaveChangesAsync();

            List <Listings> list = new List <Listings>()
            {
                GenerateListing(verified: 0, subcategoryid: 5, userid: this.fakeUser.Id),
                GenerateListing(verified: 0),
                GenerateListing(verified: 0),
                GenerateListing(verified: 1, userid: this.fakeUser.Id),
                GenerateListing(verified: 1),
                GenerateListing(verified: 0),
            };

            context.Listings.AddRange(list);
            await context.SaveChangesAsync();

            var result = await listingsController.Details(list[0].Id);

            var listingView = (ViewResult)result;
            var listing     = (ListingAndComment)listingView.Model;

            Assert.IsType <ViewResult>(result);
            // Assert
            Assert.Equal(listing.Listing.Id, list[0].Id);
        }
コード例 #29
0
        public ActionResult Create(Category category)
        {
            if (!User.IsInRole("Admin"))
            {
                return(HttpNotFound());
            }
            Subcategory sub = new Subcategory();

            sub.Name         = "Разное";
            sub.Products     = new List <Product>();
            sub.Question     = "";
            sub.RootCategory = category;
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.Subcategories.Add(sub);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
コード例 #30
0
        // GET: Subcategories/Edit/5
        public ActionResult Edit(Guid?subcategoryId)
        {
            if (subcategoryId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Subcategory subcategory = _subcategoryService.GetSubcategoryById(subcategoryId);

            if (subcategory == null)
            {
                return(HttpNotFound());
            }

            SubcategoryToEditViewModel subcategoryToEdit = new SubcategoryToEditViewModel()
            {
                SubcategoryId = subcategory.SubcategoryId,
                Name          = subcategory.Name,
                CategoryName  = subcategory.Category.Name
            };

            return(View(subcategoryToEdit));
        }
コード例 #31
0
        public async Task <IActionResult> Create(Subcategory subcategory)
        {
            if (ModelState.IsValid)
            {
                var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var values = new Subcategory
                {
                    SubcategoryID   = subcategory.SubcategoryID,
                    CategoryID      = subcategory.CategoryID,
                    SubcategoryName = subcategory.SubcategoryName,
                    UserID          = userId
                };
                _context.Add(values);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            var userId2 = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            ViewData["CategoryID"] = new SelectList(_context.Categories.Where(x => x.UserID == userId2), "CategoryID", "CategoryName", subcategory.CategoryID);
            return(View(subcategory));
        }