Why does my Web Api PUT using Entity Framework 6 keep writing new duplicate records rather than updating them?

I created my database in Entity Framework, and I also created a Web Api that uses Entity Framework. When I perform a GET or a POST (ADD) everything works great, but When I do a PUT (Update) my record is not updated, it is added as if I performed a Post. I think that the following does not recognize that the Entity has been modified:

db.Entry(contact).State = EntityState.Modified;

So, here is my entire Entity Contact.cs created by Entity Framework:

  public partial class Contact
    {
        public int Contact_ID { get; set; }
        public int Dataset_ID { get; set; }
        public string Booth_UCID { get; set; }
        public string First_Name { get; set; }
        public string Last_Name { get; set; }
        public string Title_Role { get; set; }
        public int Contact_Type_ID { get; set; }
        public string Email { get; set; }
        public string Phone_Number { get; set; }
        public string Email_2 { get; set; }
        public string Phone_Number_2 { get; set; }
    
        public virtual Contact_Type Contact_Type { get; set; }
        public virtual Dataset Dataset { get; set; }
    }

Here is the Contact model from my application that is being sent to the Web Api:

public class Contact
    {
        public int Contact_ID { get; set; }
        public int Dataset_ID { get; set; }
        public string Booth_UCID { get; set; }
        public string First_Name { get; set; }
        public string Last_Name { get; set; }
        public string Title_Role { get; set; }
        public int Contact_Type_ID { get; set; }
        public string Email { get; set; }
        public string Phone_Number { get; set; }
        public string Email_2 { get; set; }
        public string Phone_Number_2 { get; set; }
    }

And here is my MVC Application to Edit Contact

 (HttpPost)
        public ActionResult EditContact(Contact contact)
        {
            using (var client = new HttpClient())
            {

                client.BaseAddress = new Uri("http://localhost:4251/");

                //HTTP POST
                // var postTask = client.PostAsJsonAsync<Dataset>("api/datasets/1", dataset);
                var postTask = client.PostAsJsonAsync("api/contacts/2", contact);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return RedirectToAction("Index");
                }
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");

            return View(contact);
        }

and lastly, here is my Web Api with the Entity Framework scafolding: this is straight out of the box, when I created my Web Api

 // PUT: api/Contacts/5
        (ResponseType(typeof(void)))
        public async Task<IHttpActionResult> PutContact(int id, Contact contact)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != contact.Contact_ID)
            {
                return BadRequest();
            }

             
            

            db.Entry(contact).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContactExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }

I am at a loss as to what I could possible do. I feel like I should just abandon the Web Api with Entity Framework and just go ahead build an Empty Web Api where I control the update. And if so, how will this be different?

mslists – How do you duplicate a list in the Microsoft Lists App?

There are a couple of ways to do this.

  1. You can export the list to excel and then create the new list using
    that spreadsheet read here. This requires you to go to the list in sharepoint first.
  2. This might help Duplicate a list in Sharepoint Online.
    If your list is smaller than 50MB you can make your first list a template in the sharepoint settings. Go to the List Settings page Click on “Save list as Template” and make sure to check the “include content” box. more here (scroll down to: “Method 4: Copy a SharePoint list using a List Template”)
  3. You might be able to copy the list item in the document library or use save as to make a copy.

Hope these help. Like I said in the comment, from what I understand, the method you used doesn’t copy the content only the headings/titles.

bitcoin core – what is math behind elliptic curve? (duplicate)

I have seen many videos regarding the math behind the bitcoin elliptical curve but none of them showing the public key generation they are just defining few steps. i need complete math behind the elliptical curve in which the generation of public key is defined. actually i want to see visual calculation for public key generation, someone give me the link which was defining the math behind elliptical curve

what i understand that is k * n times G is equals to public key but question is remain same if kn times G (where every point of G we get from point multiplication and point addition ) then at every multiplication of kG will result a different value then how can we combine them get the public key.

Duplicate app icons in the Dock

Sometimes when opening apps I get duplicate icons in the Dock for that app. This isn’t really a problem, however I’m curious why macOS does this (I suppose this is more of a technical question).

This happens a lot especially with VS Code where I often launch the app with the code utility in the Terminal.

Dock screenshot

amazon web services – AWS: can’t duplicate DNS settings for an existant domain

I have a domain with an A record of dualstack.prod-clients-alb-1234567890.us-east-1.elb.amazonaws.com. I’m trying to have another domain point to that same server and am unable to do so. When I do so I get the following error:

Bad request.
(InvalidChangeBatch 400: ARRDATAIllegalIPv4Address (Value is not a valid IPv4 address) encountered with 'dualstack.prod-clients-alb-1234567890.us-east-1.elb.amazonaws.com.'')

If it must be set to an IPv4 address than how did my other domain get an A record of dualstack.prod-clients-alb-1234567890.us-east-1.elb.amazonaws.com.?

I also tried checking the Alias button and selecting “Alias to Network Load Balancer” for the endpoint and setting the region to us-east-1 but I’m not seeing nay resources for the network load balancer. Maybe I need to be using a different endpoint? If so can I figure out which one I would need to use from the A record of the other domain?

(both domains are going to be hosted on the same machine / ECS instance so they should have the same settings it seems to me…)

Can a cleric "multi class" between domains? [duplicate]

I have a player asking me if there is a mechanic that would allow them to take on a second domain, much in the same way a player can multi class. My gut here is no and I am contemplating instead finding out which 2 domains they wish to combine and then forming my own homebrew deity and domain that takes aspects of each, but not everything. But is there a RAW way that a player could take on multiple domains as a cleric?

performance – duplicate element removal

I have tried to remove the duplicate elements from the array using c language, here I am using 3 for loops to remove the duplicate elements.

How can this optimize the code?

Are there any other simple methods to remove the duplicate elements?

#include <stdio.h>

#define MAX_SIZE 100 // Maximum size of the array

int main()
{

 int arr(MAX_SIZE); 
 int size;        
 int i, j, k;     


printf("Enter size of the array : ");
scanf("%d", &size);


printf("Enter elements in array : ");
for(i=0; i<size; i++)
{
    scanf("%d", &arr(i));
}



for(i=0; i<size; i++)
{
    for(j=i+1; j<size; j++)
    {

        if(arr(i) == arr(j))
        {
         
            for(k=j; k<size; k++)
            {
                arr(k) = arr(k + 1);
            }

     
            size--;

            j--;
        }
    }
}

printf("nArray elements after deleting duplicates : ");
for(i=0; i<size; i++)
{
    printf("%dt", arr(i));
}

return 0;
 }

oracle – ORA-19505,ORA-17503 ORA-15012 Duplicate database in different location from prod

I’ve copied a backup from production +FRA to another diskgroup +ARC/backup in the new standby server through asmcmd cp

But I’m not able to go on with duplicate database because it does not have the same path as production:

ORA-19505: failed to identify file "+FRA/MOOTDB/AUTOBACKUP/2021_02_18/s_1064818492.421.1064818493"
ORA-17503: ksfdopn:2 Failed to open file +FRA/MOOTDB/AUTOBACKUP/2021_02_18/s_1064818492.421.1064818493
ORA-15012: ASM file '+FRA/MOOTDB/AUTOBACKUP/2021_02_18/s_1064818492.421.1064818493' does not exist
failover to previous backup

Here is my duplicate script, observe I have used BACKUP LOCATION '+ARC/backup':

run{
allocate auxiliary channel stby1 device type disk;
allocate auxiliary channel stby2 device type disk;
allocate auxiliary channel stby3 device type disk;
allocate auxiliary channel stby4 device type disk;
DUPLICATE TARGET DATABASE
FOR STANDBY
SPFILE
SET DB_UNIQUE_NAME 'mootstb'
SET DB_CREATE_FILE_DEST '+DATA'
SET DB_CREATE_ONLINE_LOG_DEST_1 '+DATA'
SET DB_CREATE_ONLINE_LOG_DEST_2 '+ARC'
SET LOG_FILE_NAME_CONVERT '+FRA','+ARC'
BACKUP LOCATION '+ARC/backup/'
NOFILENAMECHECK
DORECOVER;
}

All backup pieces and archives necessary to restore has already copied to the new server into the new diskgroup. How can I ignore it?