public IActionResult PhysicallyRemove([FromQuery] SexTypeCondition c)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                var count = db.SexType
                            .Where(c.CreatePredicate())
                            .Delete();
                return(Ok(count));
            }
        }
        public IActionResult Count([FromQuery] SexTypeCondition c)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                var count =
                    c == null?db.SexType.Count() :
                        db.SexType.Count(predicate: c.CreatePredicate());

                return(Ok(count));
            }
        }
        public IActionResult Remove([FromQuery] SexTypeCondition c)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                var count = db.SexType
                            .Where(c.CreatePredicate())
                            .Set(_ => _.modified_by, CurrentAccountId)
                            .Set(_ => _.removed_at, Sql.CurrentTimestampUtc)
                            .Update();
                return(Ok(count));
            }
        }
        public IActionResult Search([FromQuery] SexTypeCondition c, [FromQuery] string[] order, int currentPage = 1, int pageSize = 10, DateTime?p_when = null)
        {
#if DEBUG
            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (msg, context) => Debug.WriteLine(msg, context);
#endif
            using (var db = new peppaDB())
            {
                var q = db.SexType
                        .IsActiveAt(p_when)
                ;
                var filtered = c == null ? q : q.Where(c.CreatePredicate());
                var ordered  = order.Any() ? filtered.SortBy(order) : filtered;
                var result   = ordered.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
                return(Ok(result));
            }
        }