public static PacketsExtraProductCategories ModelToEnity(this PacketsExtraProductCategoriesModel model, bool virtualActive = false)
        {
            PacketsExtraProductCategories entity = new PacketsExtraProductCategories()
            {
                ExtraProductCategoryId = model.ExtraProductCategoryId,
                PacketId = model.PacketId,
                Id       = model.Id,
                IsActive = model.IsActive
            };

            if (virtualActive)
            {
                entity.Packet = model.Packet;
                entity.ExtraProductCategory = model.ExtraProductCategory;
            }
            return(entity);
        }
        public ActionResult PacketCategoryEdit(PacketsExtraProductCategoriesModel model)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Kategoriler = _serviceExtraProductCategories.GetAll().Where(x => x.IsActive == true).Select(x => new SelectListItem {
                    Text = x.Name, Value = x.Id.ToString()
                }).ToList();

                ViewBag.Paketler = _servicePackets.GetAll().Where(x => x.IsActive == true).Select(x => new SelectListItem {
                    Text = x.Name, Value = x.Id.ToString()
                }).ToList();

                _servicePacketsExtraProductCategories.Update(model.ModelToEnity());
            }


            return(RedirectToAction("PacketCategoryList"));
        }
 public static PacketsExtraProductCategoriesModel EntityToModel(this PacketsExtraProductCategories entity, bool virtualActive = false)
 {
     try
     {
         PacketsExtraProductCategoriesModel model = new PacketsExtraProductCategoriesModel()
         {
             ExtraProductCategoryId = entity.ExtraProductCategoryId,
             PacketId = entity.PacketId,
             IsActive = entity.IsActive,
             Id       = entity.Id
         };
         if (virtualActive)
         {
             model.Packet = entity.Packet;
             model.ExtraProductCategory = entity.ExtraProductCategory;
         }
         return(model);
     }
     catch (Exception)
     {
         return(new PacketsExtraProductCategoriesModel());
     }
 }