The code can be injurious

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 7 años
I am trying to insert text from richtext in the database. I get this error.

The code can be injurious <p>test </p>

Somwting like that I have translate The error from Swedish. I also have HtmlAllow in the class.
Hace 7 años
Hi,

describe all steps that lead to this error with code examples if possible.
Hace 7 años
Hi Magnus,

Are developing a plugin? Or customizing nopCommerce core?
Hace 7 años
I am developing a plugin. I Can post the code to the weekend.
Hace 7 años
Here is my code.


public class TypeOfVehicleRecord : BaseEntity
    {        
        public TypeOfVehicleRecord()
        {
            Vehicles = new List<VehicleRecord>();
        }
        public virtual int TypeOfVehicleId { get; set; }
        [NopResourceDisplayName("Plugins.Other.Vehicle.TypeOfVehicleName")]
        public virtual string TypeOfVehicleName { get; set; }
        [NopResourceDisplayName("Plugins.Other.Vehicle.TypeOfVehicleAddedDate")]
        public virtual string TypeOfVehicleAddedDate { get; set; }
        [NopResourceDisplayName("Plugins.Other.Vehicle.TypeOfVehicleDescription")]
        [AllowHtml]
        public virtual string TypeOfVehicleDescription { get; set; }

        [NopResourceDisplayName("Plugins.Other.Vehicle.TypeOfVehicleVehiclesName")]
        public virtual List<VehicleRecord> Vehicles { get; set; }
    }

public class TypeOfVehicleMap : EntityTypeConfiguration<TypeOfVehicleRecord>
    {
        public TypeOfVehicleMap()
        {
            ToTable("Vehicle_TypeOfVehicles");
            HasKey(m => m.TypeOfVehicleId);

            Property(m => m.TypeOfVehicleAddedDate);
            Property(m => m.TypeOfVehicleDescription);
            Property(m => m.TypeOfVehicleName);            
        }      
    }

[HttpPost, ParameterBasedOnFormName("save-continue", "continueEditing")]
        public ActionResult Create(TypeOfVehicleRecord typeOfVehicle, bool continueEditing)
        {
          
                TypeOfVehicleRecord record = _typeOfVehicleService.GetTypeOfVehicleById(typeOfVehicle.TypeOfVehicleId);
                if(record == null)
                {
                    record.TypeOfVehicleName = typeOfVehicle.TypeOfVehicleName;
                    record.TypeOfVehicleDescription = typeOfVehicle.TypeOfVehicleDescription;
                    record.TypeOfVehicleAddedDate = DateTime.Now.ToString();
                    record.Id = 1;
                    _typeOfVehicleService.InsertTypeOfVehicle(record);
                    //_typeOfVehicleRepo.Insert(record);
                    if (continueEditing)
                    {
                        return RedirectToAction("Edit", new { id = 1 });
                    }
                    return RedirectToAction("List");
                }
                
          

            return View(typeOfVehicle);
        }


Hace 7 años
public ActionResult Create(TypeOfVehicleRecord typeOfVehicle, bool continueEditing)
...                        
            return View(typeOfVehicle);


You're returning a class instance;  you should be returning some type of content (typically your View).  See other plugins as examples.
Hace 7 años
public ActionResult Create(TypeOfVehicleRecord typeOfVehicle, bool continueEditing)
...                        
            return View(typeOfVehicle);


You're returning a class instance;  you should be returning some type of content (typically your View).  See other plugins as examples.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.