public ActionResult Edit(int id)
        {
            var category = _categoriaRepo.GetById(id);

            var model = new EditCategoriaModel
            {

                Active = _categoriaRepo.GetActiveCategoryLabel(category.statusCategoria),
                ImgPath = category.imgPathCategoria,
                Name = category.nombreCategoria,
                IdCategoria = category.idCategoria
            };

            ViewBag.Active = _categoriaRepo.GetActiveCategoryList(category.statusCategoria);

            return View(model);
        }
        public ActionResult Edit(EditCategoriaModel model)
        {
            var category = _categoriaRepo.GetById(model.IdCategoria);

            if (model.PictureFile != null && model.PictureFile.ContentLength > 0)
            {
                var fileName = Path.GetFileName(model.PictureFile.FileName);
                if (fileName != null)
                {
                    var temp = "~/Content/dataImg/categoriesImages";
                    var name = category.idCategoria.ToString(CultureInfo.InvariantCulture) + Path.GetExtension(model.PictureFile.FileName);
                    var path = Path.Combine(Server.MapPath(temp), name);
                    model.PictureFile.SaveAs(path);
                    temp += "/" + name;
                    category.imgPathCategoria = temp;
                }
            }

            category.nombreCategoria = model.Name;
            category.statusCategoria = _categoriaRepo.ActiveCategoryValue(model.Active);

            _categoriaRepo.Update(category);

            return RedirectToAction("Index");
        }