public void Update(File inputObj) { var obj = db.Files.FirstOrDefault(x => x.ID == inputObj.ID); PropertyCopy.Copy(inputObj, obj); db.SaveChanges(); }
public void Update(Category inputObj) { if (inputObj.Files != null) { foreach (var file in inputObj.Files) { if (file.CreatedDateTime == null) { file.CreatedDateTime = DateTime.Now; } } } var obj = db.Categories.FirstOrDefault(x => x.ID == inputObj.ID); PropertyCopy.Copy(inputObj, obj); db.SaveChanges(); }