public int Upsert([FromBody] RolePermission o)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                int count = db.InsertOrReplace <RolePermission>(o);
                return(count);
            }
        }
Ejemplo n.º 2
0
        public IActionResult Upsert([FromBody] Test o)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            if (ModelState.IsValid)
            {
                using (var db = new peppaDB())
                {
                    int count = db.InsertOrReplace <Test>(o);
                    return(Ok(count));
                }
            }
            return(BadRequest());
        }
Ejemplo n.º 3
0
        public IActionResult Upsert([FromBody] Account 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 <Account>(o);
                    return(Ok(count));
                }
            }
            return(BadRequest());
        }