Skip to main content

Notifications

Dynamics 365 general forum

Multiple update data using put method web api

Posted on by Microsoft Employee
public HttpResponseMessage Put(DelegateTable delegatestable)
        {
            try
            {
             
                using (var ctx = new ShowContext())
                {

                    var delegatedata = ctx.delegates.FirstOrDefault(s => s.Barcode__c == delegatestable.Barcode__c);

                    if (delegatedata != null)
                    {
                        if (delegatestable.Salutation__c!=null)
                        {
                            delegatedata.Salutation__c = delegatestable.Salutation__c;
                        }
                        if (delegatestable.First_Name__c != null)
                        {
                            delegatedata.First_Name__c = delegatestable.First_Name__c;
                        }
                        if (delegatestable.Last_Name__c != null)
                        {
                            delegatedata.Last_Name__c = delegatestable.Last_Name__c;
                        }
                        if (delegatestable.Account_Name__c != null)
                        {
                            delegatedata.Account_Name__c = delegatestable.Account_Name__c;
                        }
                        if (delegatestable.Contact_Email__c != null)
                        {
                            delegatedata.Contact_Email__c = delegatestable.Contact_Email__c;
                        }
                        if (delegatestable.Category__c != null)
                        {
                            delegatedata.Category__c = delegatestable.Category__c;
                        }
                        if (delegatestable.Conference_Type__c != null)
                        {
                            delegatedata.Conference_Type__c = delegatestable.Conference_Type__c;
                        }
                        if (delegatestable.Conference_Selection__c != null)
                        {
                            delegatedata.Conference_Selection__c = delegatestable.Conference_Selection__c;
                        }
                        if (delegatestable.Payment_Status_Interface__c != null)
                        {
                            delegatedata.Payment_Status_Interface__c = delegatestable.Payment_Status_Interface__c;
                        }
                        
                        //  delegatedata.Barcode__c = delegatestable.Barcode__c;

                        ctx.SaveChanges();
                        return Request.CreateResponse(HttpStatusCode.OK, "Record updated");
                    }
                    else
                    {
                        return Request.CreateResponse(HttpStatusCode.NoContent, delegatedata);
                    }
                }
            }
            catch (Exception ex)
            {

                return Request.CreateResponse(HttpStatusCode.BadGateway, ex);
            }
        }





How to multiple update data using put method web api. I have used single update but i am unable to write code for multiple update. I am using json for updating data through postman application. Single update is working through it properly but i dont know how to multiple update. Please help

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Multiple update data using put method web api

    What Microsoft Dynamics product/application are you using?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans