Created
June 7, 2020 15:53
-
-
Save alimozdemir/681362a5488da4f9d36981abf61d0ea0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPatch] | |
public async Task Patch([FromODataUri] int key, Delta<vw_Song> delta) | |
{ | |
var changedProps = delta.GetChangedPropertyNames(); | |
var instance = delta.GetInstance(); | |
var updateDict = new Dictionary<string, object>(); | |
if (changedProps.Contains("Status")) | |
{ | |
updateDict.Add("Status", instance.Status); | |
} | |
var q = new SqlKata.Query("Country_Songs") | |
.Where("SongId", key) | |
.AsUpdate(updateDict); | |
var result = _compiler.Compile(q); | |
await _db.Database.ExecuteSqlRawAsync(result.Sql, result.Bindings); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment