コード例 #1
0
        public async Task <object> Add(Project entity)
        {
            string storedProcedure = String.Empty;
            object result;
            int    key = 0;

            storedProcedure = Settings.Database.StoredProcedures.FirstOrDefault(p => p == ADD_PROC);
            if (storedProcedure == null)
            {
                SqlCommandType = Constants.DBCommandType.SQL;
                CMDText        = ADD_STMT;
            }
            else
            {
                SqlCommandType = Constants.DBCommandType.SPROC;
                CMDText        = storedProcedure;
            }
            MapFromObject = new ProjectMapFromObject(logger);
            result        = await base.Add(entity, entity.PK);

            if (result != null)
            {
                key = Convert.ToInt32(result);
            }
            else
            {
                key = -1;
            }
            return(key);
        }
コード例 #2
0
        public async Task <int> Update(Project entity)
        {
            string storedProcedure = String.Empty;

            storedProcedure = Settings.Database.StoredProcedures.FirstOrDefault(p => p == UPDATE_PROC);
            if (storedProcedure == null)
            {
                SqlCommandType = Constants.DBCommandType.SQL;
                CMDText        = UPDATE_STMT;
            }
            else
            {
                SqlCommandType = Constants.DBCommandType.SPROC;
                CMDText        = storedProcedure;
            }
            MapFromObject = new ProjectMapFromObject(logger);
            return(await base.Update(entity, entity.PK));
        }