Beispiel #1
0
        public async Task <Department_UpdateResult[]> Department_Update(int?DepartmentID, string Name, decimal?Budget, DateTime?StartDate, int?InstructorID, byte[] RowVersion_Original, OutputParameter <int> returnValue = null)
        {
            var parameterDepartmentID = new SqlParameter
            {
                ParameterName = "DepartmentID",
                Value         = DepartmentID ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Int,
            };

            var parameterName = new SqlParameter
            {
                ParameterName = "Name",
                Size          = 100,
                Value         = Name ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.NVarChar,
            };

            var parameterBudget = new SqlParameter
            {
                ParameterName = "Budget",
                Value         = Budget ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Money,
            };

            var parameterStartDate = new SqlParameter
            {
                ParameterName = "StartDate",
                Value         = StartDate ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.DateTime,
            };

            var parameterInstructorID = new SqlParameter
            {
                ParameterName = "InstructorID",
                Value         = InstructorID ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Int,
            };

            var parameterRowVersion_Original = new SqlParameter
            {
                ParameterName = "RowVersion_Original",
                Value         = RowVersion_Original ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Timestamp,
            };

            var parameterreturnValue = new SqlParameter
            {
                ParameterName = "returnValue",
                Direction     = System.Data.ParameterDirection.Output,
                SqlDbType     = System.Data.SqlDbType.Int,
            };

            var _ = await _context.SqlQuery <Department_UpdateResult>("EXEC @returnValue = [dbo].[Department_Update] @DepartmentID, @Name, @Budget, @StartDate, @InstructorID, @RowVersion_Original", parameterDepartmentID, parameterName, parameterBudget, parameterStartDate, parameterInstructorID, parameterRowVersion_Original, parameterreturnValue);

            returnValue?.SetValue(parameterreturnValue.Value);

            return(_);
        }
Beispiel #2
0
        public async Task <int> Department_Delete(int?DepartmentID, byte[] RowVersion_Original, OutputParameter <int> returnValue = null)
        {
            var parameterDepartmentID = new SqlParameter
            {
                ParameterName = "DepartmentID",
                Value         = DepartmentID ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Int,
            };

            var parameterRowVersion_Original = new SqlParameter
            {
                ParameterName = "RowVersion_Original",
                Value         = RowVersion_Original ?? Convert.DBNull,
                SqlDbType     = System.Data.SqlDbType.Timestamp,
            };

            var parameterreturnValue = new SqlParameter
            {
                ParameterName = "returnValue",
                Direction     = System.Data.ParameterDirection.Output,
                SqlDbType     = System.Data.SqlDbType.Int,
            };

            var _ = await _context.Database.ExecuteSqlRawAsync("EXEC @returnValue = [dbo].[Department_Delete] @DepartmentID, @RowVersion_Original", parameterDepartmentID, parameterRowVersion_Original, parameterreturnValue);

            returnValue?.SetValue(parameterreturnValue.Value);

            return(_);
        }