CRUD actions with odata

Hi,

I have asp.net core API with odata running on it and on the client-side I have react web app.
Now I have accomplished to get the data and show on the scheduler with the ODataV4Adaptor, but the rest of the crud actions doesn't work.

Can you provide a sample project with the correct odata approach? 

The code that I now have on the clientside.

 <ScheduleComponent
                    height='900px' 
                    local='nl'
                    currentView='WorkWeek'
                    timezone='Europe/Amsterdam'
                    eventSettings={ { 
                      fields: {
                        id: 'Oid',
                        subject: { name: 'Subject' },
                        isAllDay: { name: 'IsAllDay' },
                        startTime: { name: 'StartTime' },
                        endTime: { name: 'EndTime' }
                    },
                        dataSource: new DataManager({
                        url: '/odata/order',
                        crossDomain: true,
                        adaptor: new ODataV4Adaptor,
                            headers: [{
                                'AUTHORIZATION': `Bearer ${localStorage.getItem('token')}`
                            }],
                       
                    })} }>
                    <ViewsDirective>
                        <ViewDirective option='WorkWeek' interval={1} timeScale={{ enable: true, slotCount: 4 }} startHour='07:00' endHour='18:00'/>
                        <ViewDirective option='Week' startHour='07:00' endHour='22:00'/>
                        <ViewDirective option='Month' showWeekNumber={true}  showWeekend={true}/>
                    </ViewsDirective>
                <Inject services={[Day, Week, WorkWeek, Month, Agenda, Resize, DragAndDrop]}/>
                </ScheduleComponent>

When I look in the console the POST URL is : https://localhost:5001/odata/$batch
But the GET URL is: https://localhost:5001/odata/order
I expect it to be :POST https://localhost:5001/odata/order/$batch or POST https://localhost:5001/odata/order
The exeption that i get on server side is : System.ArgumentException: An item with the same key has already been added. Key: Cookie

3 Replies 1 reply marked as answer

HB Hareesh Balasubramanian Syncfusion Team October 22, 2020 07:32 AM UTC

Hi Vedad, 

Greetings from Syncfusion Support..! 

We have prepared a CRUD sample based on your shared query using ODataV4 Adaptor which can be downloaded from the following link. 


this.dataManger = new DataManager({ 
  adaptor: new ODataV4Adaptor(), 
  crossDomain: true 
}); 
this.dataQuery = new Query().from("EventDatas"); 
<ScheduleComponent 
  width="100%" 
  height="650px" 
  selectedDate={new Date(2018, 9, 4)} 
  eventSettings={{ 
                dataSource: this.dataManger, 
                query: this.dataQuery 
  }}> 
  <Inject services={[ Day, Week, WorkWeek, Month, Agenda, Resize, DragAndDrop ]}/> 
</ScheduleComponent> 

Kindly try the above sample and get back to us if you need any further assistance. 

Regards, 
Hareesh 


Marked as answer

VE Vedad October 24, 2020 05:08 PM UTC

Thank you !!

I forgot the query part


VM Vengatesh Maniraj Syncfusion Team October 26, 2020 07:06 AM UTC

Hi Vedad, 

You are most welcome. 

Please get back to us if you need any further assistance. 

Regards, 
Vengatesh  


Loader.
Up arrow icon