Whenever I'm adding a new object from the front end, the id = 0. In the WebApi layer, I'm trying to find the max ID that exists in the list of events and then assign the next ID to the new objects. The code below doesn't increment the ID correctly
List<Event> events = eventVal.Where(e => e != null).ToList();
int eventMaxID = events.Max(e => e.id);
events.Select(e => e.id == 0)
.Select((e, ixc) => new { id = eventMaxID + 1, Iter = eventMaxID + 1 })
.ToList();I'm not sure how to use the second parameter for the Select method.
Any help would be appreciated! Thanks.