I looked all over the internet and still couldn’t find a solution to this.
I tried the attach method:
public static void updatePhoto(string name, string albumName, string newName, string newPath)
{
//updates photo... no delete and adding...
var photo = new Image(){Label=newName, Path = newPath};
using (var db = new EzPrintsEntities())
{
db.Images.Attach(photo);
db.SaveChanges();
}
}
but that did not do anything at all.
So the question then is how do you implement an UPDATE to the sql database through EF in the code below?
public static void updatePhoto(string name, string albumName, string newName, string newPath)
{
EzPrintsEntities db = new EzPrintsEntities();
}
If you’re updating an existing photo, you need to load it, and change the existing value: