public JsonResult PacketCategoryDelete(int id)
 {
     if (_servicePacketsExtraProductCategories.GetById(id) != null)
     {
         PacketsExtraProductCategories p = _servicePacketsExtraProductCategories.GetById(id);
         p.IsActive = false;
         _servicePacketsExtraProductCategories.Update(p);
         return(Json(true, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(false, JsonRequestBehavior.AllowGet));
     }
 }
        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 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 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());
     }
 }