Click here to Skip to main content
15,888,968 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: post list of products instead of single product in post method odata Pin
dan!sh 28-Aug-18 22:40
professional dan!sh 28-Aug-18 22:40 
Rant[REPOST] post list of products instead of single product in post method odata Pin
Richard Deeming29-Aug-18 2:58
mveRichard Deeming29-Aug-18 2:58 
QuestionSub Level Hyperlink not showing in asp.net Pin
Member 1115418828-Aug-18 19:13
Member 1115418828-Aug-18 19:13 
AnswerRe: Sub Level Hyperlink not showing in asp.net Pin
dan!sh 28-Aug-18 20:55
professional dan!sh 28-Aug-18 20:55 
GeneralRe: Sub Level Hyperlink not showing in asp.net Pin
Member 1115418828-Aug-18 21:04
Member 1115418828-Aug-18 21:04 
GeneralRe: Sub Level Hyperlink not showing in asp.net Pin
dan!sh 28-Aug-18 21:09
professional dan!sh 28-Aug-18 21:09 
QuestionHow to publish more than one webapps from visual studio in single click Pin
Dominic Louis27-Aug-18 20:12
Dominic Louis27-Aug-18 20:12 
Question.Net Core 2.1, MongoDB, add states collection to country states collection Pin
jkirkerx24-Aug-18 12:31
professionaljkirkerx24-Aug-18 12:31 
I thought I could do this in one sweep off the states seed.
But I keep getting 0 in the Countries states .
As a refresher:
public class WEBSITE_COUNTRIES
{
    [BsonId]
    [BsonRepresentation(BsonType.ObjectId)]
    public ObjectId Id { get; set; }

    public string DisplayId { get; set; }
    public string LongName { get; set; }
    public string ShortName { get; set; }
    public bool Enabled { get; set; }

    public List<WEBSITE_STATES> States { get; set; }
}

So I have a country collection that I grabbed to read data from called websiteCountries
I figured I could use the same collection to write to as well, maybe I'm wrong.
So I grabbed the country collection for US, then all the States for US, 56 of them.
I just can't get a write to US-States[].
At first try, I had no states: [], so I went back to countries and added a blank states[].
// Inject a state/province
ObjectId US_VI_Id = ObjectId.GenerateNewId();
var state_VI = new WEBSITE_STATES() { Id = US_VI_Id, DisplayId = US_VI_Id.ToString(), CountryId = country.DisplayId, CountryCode = country.ShortName, LongName = "Virgin Islands", ShortName = "VI", Enabled = true }
await websiteStates.InsertOneAsync(state_VI);

// Let See if we can inject the States collection into Countries/States                            
WEBSITE_COUNTRIES country_US = await websiteCountries.Find(c => c.ShortName == country.ShortName).FirstOrDefaultAsync();
ICollection<WEBSITE_STATES> states_US = await websiteStates.FindSync(c => c.CountryCode == country.ShortName).ToListAsync();
// about 10 different tries here, such as loop states and insert, AddRange(0, states_US)
and I always get this.
{
    "_id" : ObjectId("5b8080730cf709469424b9e2"),
    "DisplayId" : "5b8080730cf709469424b9e2",
    "LongName" : "United States",
    "ShortName" : "US",
    "Enabled" : true,
    "States" : []
}

Maybe I'm suppose to InsertOneAsync(entire state record); that's all that I can think of at the moment.
Anyways, it's Friday, going home to wash the car and get ready for bowling, easy things to accomplish.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

Question.Net Core 2.1, seeding a MongoDB, foreach on Countries, Pin
jkirkerx24-Aug-18 9:47
professionaljkirkerx24-Aug-18 9:47 
AnswerRe: .Net Core 2.1, seeding a MongoDB, foreach on Countries, [sort of solved] Pin
jkirkerx24-Aug-18 10:25
professionaljkirkerx24-Aug-18 10:25 
General[solved] Pin
jkirkerx27-Aug-18 7:59
professionaljkirkerx27-Aug-18 7:59 
QuestionAccess HttpContext in ASP.NET Core Pin
JimFeng22-Aug-18 6:35
JimFeng22-Aug-18 6:35 
AnswerRe: Access HttpContext in ASP.NET Core Pin
Vincent Maverick Durano22-Aug-18 8:40
professionalVincent Maverick Durano22-Aug-18 8:40 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng23-Aug-18 5:07
JimFeng23-Aug-18 5:07 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Vincent Maverick Durano23-Aug-18 7:42
professionalVincent Maverick Durano23-Aug-18 7:42 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng23-Aug-18 8:39
JimFeng23-Aug-18 8:39 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Vincent Maverick Durano23-Aug-18 10:28
professionalVincent Maverick Durano23-Aug-18 10:28 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Richard Deeming23-Aug-18 9:14
mveRichard Deeming23-Aug-18 9:14 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng24-Aug-18 9:21
JimFeng24-Aug-18 9:21 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Richard Deeming28-Aug-18 2:02
mveRichard Deeming28-Aug-18 2:02 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng28-Aug-18 7:09
JimFeng28-Aug-18 7:09 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Richard Deeming28-Aug-18 7:16
mveRichard Deeming28-Aug-18 7:16 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng28-Aug-18 7:46
JimFeng28-Aug-18 7:46 
GeneralRe: Access HttpContext in ASP.NET Core Pin
Richard Deeming28-Aug-18 7:56
mveRichard Deeming28-Aug-18 7:56 
GeneralRe: Access HttpContext in ASP.NET Core Pin
JimFeng28-Aug-18 7:57
JimFeng28-Aug-18 7:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.