Base solution for your next web application

Activities of "soulmate"

Hey, Thank you for your reply. I already had a working provider configuration:

using System.Data.Entity.ModelConfiguration;

namespace Entities
{
    public class ProviderConfiguration : EntityTypeConfiguration<Provider>
    {
        public ProviderConfiguration()
        {
      
    HasMany(c => c.Countries).WithMany(i => i.Providers)
    .Map(t => t.MapLeftKey("ProviderId")
        .MapRightKey("CountryId")
        .ToTable("Providers_Countries"));

         
        }
    }
}

However, I deleted the configuration to follow your sugesstions. The database structure looks good for me (see attachment). However, I still cant save entities :(

Nevermind, I fixed it.

My code was

[System.Web.Http.HttpGet]
        [DontWrapResult]
        public async Task<ActionResult> Get()
        {
            var countrys = await _countryAppService.GetAllAsync();

            return Json(countrys, JsonRequestBehavior.AllowGet);
        }

However, because countrys is of type ListResultOutput<CountryViewModel> I need to change it to:

[System.Web.Http.HttpGet]
        [DontWrapResult]
        public async Task<ActionResult> Get()
        {
            var countrys = await _countryAppService.GetAllAsync();

            return Json(countrys.Items, JsonRequestBehavior.AllowGet);
        }

Hi, The attribute does not seem to help very much. I copied my controller from a working version of another project. My method returns: [{"Name":"Germany","Id":2}]

However, the same method with the DontWrapResult returns {"Items":[{"Name":"Germany","Id":2}]}

Showing 21 to 23 of 23 entries