public IActionResult Modify(int workStyleTypeId, [FromBody] WorkStyleType o) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif if (ModelState.IsValid) { using (var db = new peppaDB()) { o.modified_by = CurrentAccountId; var count = db.Update <WorkStyleType>(o); return(Ok(count)); } } return(BadRequest()); }
public IActionResult Create([FromBody] WorkStyleType o) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif if (ModelState.IsValid) { using (var db = new peppaDB()) { o.created_by = CurrentAccountId; o.modified_by = CurrentAccountId; o.uid = db.InsertWithInt32Identity <WorkStyleType>(o); return(CreatedAtAction(nameof(Get), new { workStyleTypeId = o.work_style_type_id }, o)); } } return(BadRequest()); }
public IActionResult Upsert([FromBody] WorkStyleType o) { #if DEBUG DataConnection.TurnTraceSwitchOn(); DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context); #endif if (ModelState.IsValid) { using (var db = new peppaDB()) { if (o.uid == 0) { o.created_by = CurrentAccountId; } o.modified_by = CurrentAccountId; int count = db.InsertOrReplace <WorkStyleType>(o); return(Ok(count)); } } return(BadRequest()); }