Ejemplo n.º 1
0
        public BulkCopyRowsCopied MassiveCreate([FromBody] IEnumerable <Account> os)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                var ret = db.BulkCopy <Account>(os);
                return(ret);
            }
        }
Ejemplo n.º 2
0
        public IActionResult MassiveCreate([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 ret = db.BulkCopy <Test>(os);
                    return(Ok(ret));
                }
            }
            return(BadRequest());
        }
Ejemplo n.º 3
0
        public IActionResult MassiveCreate([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)
                    {
                        o.created_by  = CurrentAccountId;
                        o.modified_by = CurrentAccountId;
                    }

                    var ret = db.BulkCopy <Account>(os);
                    return(Ok(ret));
                }
            }
            return(BadRequest());
        }