public int Merge([FromBody] IEnumerable <Account> os) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif using (var db = new peppaDB()) { var count = db.Merge <Account>(os); return(count); } }
public IActionResult Merge([FromBody] IEnumerable <Test> os) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif if (ModelState.IsValid) { using (var db = new peppaDB()) { var count = db.Merge <Test>(os); return(Ok(count)); } } return(BadRequest()); }
public IActionResult Merge([FromBody] IEnumerable <Account> os) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif if (ModelState.IsValid) { using (var db = new peppaDB()) { foreach (var o in os) { if (o.uid == 0) { o.created_by = CurrentAccountId; } o.modified_by = CurrentAccountId; } var count = db.Merge <Account>(os); return(Ok(count)); } } return(BadRequest()); }