0

I am using VS2015 and have MVC5 web app. I want to use scaffolding feature to generate CRUD for my child entities: currently when generating the scaffolding it is NOT creating the views/edit/create for the IEnumerable collection 'Cities'. I have googled but not found anything. Is there a Nuget package that does what I want. It should allow to add/delete/edit the cities maybe using partial view but should be auto-generated.

code:

    public partial class Country
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Color { get; set; }
        public string Location { get; set; }
        public virtual IEnumerable<Cities> Cities { get; set; }
    }

    public partial class Cities
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string TreLocation { get; set; }
        public string Geo { get; set; }
    }
user2906420
  • 1,249
  • 6
  • 27
  • 44
  • `public virtual IEnumerable Cities { get; set; }` => this is usually marked as navigation property in EF, because it refers other entity class. As far as I know, navigation properties are not included during controller/view scaffolding. – Tetsuya Yamamoto Feb 20 '19 at 08:43

1 Answers1

0

Do you want an editable list of cities under each country?

Don't use mvc! In the time you spend figuring it out, you can probably learn angular. Which is far better for tis sort of thing.

However, back in the mists of time wise sages wrestled with this problem, for example....

Collection of complex child objects in Asp.Net MVC 3 application?

https://www.donnfelker.com/editable-grid-list-binding-in-mvc2/&ved=2ahUKEwiltefd9cngAhWjQxUIHe45AM4QFjACegQIARAB&usg=AOvVaw2z8iH5hZnObcnIMl3d4cyI

ajd
  • 423
  • 4
  • 11